Hello cprince,

I'd like you to do a code review.  Please execute
        g4 diff -c 10099212

or point your web browser to
        http://mondrian/10099212

to review the following code:

Change 10099212 by nigel...@nigeltao-srcwingears5 on 2009/02/11 15:12:09 
*pending*

        Re-enable the canvas, with Skia now built from source.
        
        R=cprince
        [email protected]
        DELTA=329  (294 added, 8 deleted, 27 changed)
        OCL=10099212

Affected files ...

... //depot/googleclient/gears/opensource/gears/Makefile#232 edit
... 
//depot/googleclient/gears/opensource/gears/canvas/blob_backed_skia_input_stream.h#2
 edit
... 
//depot/googleclient/gears/opensource/gears/canvas/blob_backed_skia_output_stream.h#2
 edit
... //depot/googleclient/gears/opensource/gears/canvas/canvas.cc#21 edit
... //depot/googleclient/gears/opensource/gears/canvas/canvas.h#16 edit
... 
//depot/googleclient/gears/opensource/gears/canvas/canvas_rendering_context_2d.cc#17
 edit
... 
//depot/googleclient/gears/opensource/gears/canvas/canvas_rendering_context_2d.h#12
 edit
... //depot/googleclient/gears/opensource/gears/factory/factory_impl.cc#25 edit
... //depot/googleclient/gears/opensource/gears/test/manual/canvas.html#1 add
... //depot/googleclient/gears/opensource/gears/tools/config.mk#100 edit
... //depot/googleclient/gears/opensource/gears/tools/rules.mk#103 edit
... //depot/googleclient/gears/opensource/third_party/skia/README.google#1 edit
... 
//depot/googleclient/gears/opensource/third_party/skia/include/core/SkUserConfig.h#1
 edit
... //depot/googleclient/gears/opensource/third_party/skia/src/core/SkFP.h#1 
edit
... 
//depot/googleclient/gears/opensource/third_party/skia/src/images/SkImageDecoder_libjpeg.cpp#1
 edit
... 
//depot/googleclient/gears/opensource/third_party/skia/src/images/SkImageDecoder_libpng.cpp#1
 edit
... 
//depot/googleclient/gears/opensource/third_party/skia/src/ports/SkFontHost_win.cpp#1
 edit
... 
//depot/googleclient/gears/opensource/third_party/skia/src/ports/gears_skia_win_fixes.cpp#1
 add

329 delta lines: 294 added, 8 deleted, 27 changed

Also consider running:
        g4 lint -c 10099212

which verifies that the changelist doesn't introduce new style violations.

If you can't do the review, please let me know as soon as possible.  During
your review, please ensure that all new code has corresponding unit tests and
that existing unit tests are updated appropriately.  Visit
http://www/eng/code_review.html for more information.

This is a semiautomated message from "g4 mail".  Complaints or suggestions?
Mail [email protected].
Change 10099212 by nigel...@nigeltao-srcwingears5 on 2009/02/11 15:12:09 
*pending*

        Re-enable the canvas, with Skia now built from source.

Affected files ...

... //depot/googleclient/gears/opensource/gears/Makefile#232 edit
... 
//depot/googleclient/gears/opensource/gears/canvas/blob_backed_skia_input_stream.h#2
 edit
... 
//depot/googleclient/gears/opensource/gears/canvas/blob_backed_skia_output_stream.h#2
 edit
... //depot/googleclient/gears/opensource/gears/canvas/canvas.cc#21 edit
... //depot/googleclient/gears/opensource/gears/canvas/canvas.h#16 edit
... 
//depot/googleclient/gears/opensource/gears/canvas/canvas_rendering_context_2d.cc#17
 edit
... 
//depot/googleclient/gears/opensource/gears/canvas/canvas_rendering_context_2d.h#12
 edit
... //depot/googleclient/gears/opensource/gears/factory/factory_impl.cc#25 edit
... //depot/googleclient/gears/opensource/gears/test/manual/canvas.html#1 add
... //depot/googleclient/gears/opensource/gears/tools/config.mk#100 edit
... //depot/googleclient/gears/opensource/gears/tools/rules.mk#103 edit
... //depot/googleclient/gears/opensource/third_party/skia/README.google#1 edit
... 
//depot/googleclient/gears/opensource/third_party/skia/include/core/SkUserConfig.h#1
 edit
... //depot/googleclient/gears/opensource/third_party/skia/src/core/SkFP.h#1 
edit
... 
//depot/googleclient/gears/opensource/third_party/skia/src/images/SkImageDecoder_libjpeg.cpp#1
 edit
... 
//depot/googleclient/gears/opensource/third_party/skia/src/images/SkImageDecoder_libpng.cpp#1
 edit
... 
//depot/googleclient/gears/opensource/third_party/skia/src/ports/SkFontHost_win.cpp#1
 edit
... 
//depot/googleclient/gears/opensource/third_party/skia/src/ports/gears_skia_win_fixes.cpp#1
 add

==== //depot/googleclient/gears/opensource/gears/Makefile#232 - 
c:\devel\srcwingears5/googleclient/gears/opensource/gears/Makefile ====
# action=edit type=text
--- googleclient/gears/opensource/gears/Makefile        2009-02-11 
11:58:55.000000000 +1100
+++ googleclient/gears/opensource/gears/Makefile        2009-02-11 
14:32:32.000000000 +1100
@@ -365,6 +365,145 @@
 THIRD_PARTY_CPPSRCS    += \
                modp_b64.cc \
                $(NULL)
+
+#-----------------------------------------------------------------------------
+# third_party/skia
+
+ifneq ($(OFFICIAL_BUILD),1)
+THIRD_PARTY_VPATH      += \
+               ../third_party/skia/src/core \
+               ../third_party/skia/src/images \
+               ../third_party/skia/src/ports \
+               $(NULL)
+
+# this section from skia/src/core
+THIRD_PARTY_CPPSRCS    += \
+               Sk64.cpp \
+               SkAlphaRuns.cpp \
+               SkBitmap.cpp \
+               SkBitmapProcShader.cpp \
+               SkBitmapProcState.cpp \
+               SkBitmapProcState_matrixProcs.cpp \
+               SkBitmapSampler.cpp \
+               SkBitmapShader.cpp \
+               SkBitmap_scroll.cpp \
+               SkBlitRow_D16.cpp \
+               SkBlitRow_D4444.cpp \
+               SkBlitter.cpp \
+               SkBlitter_4444.cpp \
+               SkBlitter_A1.cpp \
+               SkBlitter_A8.cpp \
+               SkBlitter_ARGB32.cpp \
+               SkBlitter_RGB16.cpp \
+               SkBlitter_Sprite.cpp \
+               SkBuffer.cpp \
+               SkCanvas.cpp \
+               SkChunkAlloc.cpp \
+               SkColor.cpp \
+               SkColorFilter.cpp \
+               SkColorTable.cpp \
+               SkComposeShader.cpp \
+               SkCordic.cpp \
+               SkDebug.cpp \
+               SkDebug_stdio.cpp \
+               SkDeque.cpp \
+               SkDevice.cpp \
+               SkDither.cpp \
+               SkDraw.cpp \
+               SkEdge.cpp \
+               SkFilterProc.cpp \
+               SkFlattenable.cpp \
+               SkFloat.cpp \
+               SkFloatBits.cpp \
+               SkGeometry.cpp \
+               SkGlobals.cpp \
+               SkGlyphCache.cpp \
+               SkGraphics.cpp \
+               SkMask.cpp \
+               SkMaskFilter.cpp \
+               SkMath.cpp \
+               SkMatrix.cpp \
+               SkMemory_stdlib.cpp \
+               SkPackBits.cpp \
+               SkPaint.cpp \
+               SkPath.cpp \
+               SkPathEffect.cpp \
+               SkPathHeap.cpp \
+               SkPathMeasure.cpp \
+               SkPicture.cpp \
+               SkPictureFlat.cpp \
+               SkPicturePlayback.cpp \
+               SkPictureRecord.cpp \
+               SkPixelRef.cpp \
+               SkPoint.cpp \
+               SkProcSpriteBlitter.cpp \
+               SkPtrRecorder.cpp \
+               SkQuadClipper.cpp \
+               SkRasterizer.cpp \
+               SkRect.cpp \
+               SkRefCnt.cpp \
+               SkRegion.cpp \
+               SkRegion_path.cpp \
+               SkScalerContext.cpp \
+               SkScan.cpp \
+               SkScan_AntiPath.cpp \
+               SkScan_Antihair.cpp \
+               SkScan_Hairline.cpp \
+               SkScan_Path.cpp \
+               SkShader.cpp \
+               SkSpriteBlitter_ARGB32.cpp \
+               SkSpriteBlitter_RGB16.cpp \
+               SkStream.cpp \
+               SkString.cpp \
+               SkStroke.cpp \
+               SkStrokerPriv.cpp \
+               SkTSearch.cpp \
+               SkTypeface.cpp \
+               SkUnPreMultiply.cpp \
+               SkUtils.cpp \
+               SkWriter32.cpp \
+               SkXfermode.cpp \
+               $(NULL)
+
+# this section from skia/src/images
+THIRD_PARTY_CPPSRCS    += \
+               SkImageDecoder.cpp \
+               SkImageDecoder_Factory.cpp \
+               SkImageDecoder_libjpeg.cpp \
+               SkImageDecoder_libpng.cpp \
+               SkImageEncoder.cpp \
+               SkImageEncoder_Factory.cpp \
+               SkScaledBitmapSampler.cpp \
+               $(NULL)
+
+# this section from skia/src/ports (except skia/src/SkMMapStream.cpp)
+ifeq ($(OS),linux)
+THIRD_PARTY_CPPSRCS    += \
+               SkMMapStream.cpp \
+               SkThread_pthread.cpp \
+               $(NULL)
+else
+ifeq ($(OS),osx)
+THIRD_PARTY_CPPSRCS    += \
+               SkThread_pthread.cpp \
+               $(NULL)
+else
+ifeq ($(OS),win32)
+THIRD_PARTY_CPPSRCS    += \
+               gears_skia_win_fixes.cpp \
+               SkFontHost_win.cpp \
+               SkGlobals_global.cpp \
+               SkThread_win.cpp \
+               $(NULL)
+else
+THIRD_PARTY_CPPSRCS    += \
+               SkThread_none.cpp \
+               $(NULL)
+endif
+endif
+endif
+
+endif # not OFFICIAL_BUILD
 
 #-----------------------------------------------------------------------------
 # third_party/spidermonkey
@@ -1164,9 +1303,6 @@
 # The Canvas API is not yet enabled in official builds.
 else
 
-# The Canvas API is temporarily disabled whilst we switch the Skia dependency
-# from being a pre-built binary static library to being built from source.
-ifeq (0,1)
 $(BROWSER)_VPATH += \
                canvas \
                $(NULL)
@@ -1177,7 +1313,6 @@
                canvas.cc \
                canvas_rendering_context_2d.cc \
                $(NULL)
-endif  # Temporarily disabled
 endif  # OFFICIAL_BUILD
 
 #-----------------------------------------------------------------------------
==== 
//depot/googleclient/gears/opensource/gears/canvas/blob_backed_skia_input_stream.h#2
 - 
c:\devel\srcwingears5/googleclient/gears/opensource/gears/canvas/blob_backed_skia_input_stream.h
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/canvas/blob_backed_skia_input_stream.h  
2009-02-11 11:58:55.000000000 +1100
+++ googleclient/gears/opensource/gears/canvas/blob_backed_skia_input_stream.h  
2009-02-11 11:59:17.000000000 +1100
@@ -28,7 +28,7 @@
 
 #include "gears/base/common/basictypes.h"
 #include "gears/blob/blob_interface.h"
-#include "third_party/skia/include/SkStream.h"
+#include "third_party/skia/include/core/SkStream.h"
 
 class BlobBackedSkiaInputStream : public SkStream {
  public:
==== 
//depot/googleclient/gears/opensource/gears/canvas/blob_backed_skia_output_stream.h#2
 - 
c:\devel\srcwingears5/googleclient/gears/opensource/gears/canvas/blob_backed_skia_output_stream.h
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/canvas/blob_backed_skia_output_stream.h 
2009-02-11 11:58:56.000000000 +1100
+++ googleclient/gears/opensource/gears/canvas/blob_backed_skia_output_stream.h 
2009-02-11 11:59:25.000000000 +1100
@@ -27,7 +27,7 @@
 #define GEARS_CANVAS_BLOB_BACKED_SKIA_OUTPUT_STREAM_H__
 
 #include "gears/blob/blob_builder.h"
-#include "third_party/skia/include/SkStream.h"
+#include "third_party/skia/include/core/SkStream.h"
 
 class BlobBackedSkiaOutputStream : public SkWStream {
  public:
==== //depot/googleclient/gears/opensource/gears/canvas/canvas.cc#21 - 
c:\devel\srcwingears5/googleclient/gears/opensource/gears/canvas/canvas.cc ====
# action=edit type=text
--- googleclient/gears/opensource/gears/canvas/canvas.cc        2009-02-11 
11:58:56.000000000 +1100
+++ googleclient/gears/opensource/gears/canvas/canvas.cc        2009-02-11 
11:59:32.000000000 +1100
@@ -30,10 +30,11 @@
 #include "gears/canvas/blob_backed_skia_input_stream.h"
 #include "gears/canvas/blob_backed_skia_output_stream.h"
 #include "gears/canvas/canvas_rendering_context_2d.h"
-#include "third_party/skia/include/SkCanvas.h"
-#include "third_party/skia/include/SkImageDecoder.h"
-#include "third_party/skia/include/SkRect.h"
-#include "third_party/skia/include/SkStream.h"
+#include "third_party/skia/include/core/SkCanvas.h"
+#include "third_party/skia/include/core/SkRect.h"
+#include "third_party/skia/include/core/SkStream.h"
+#include "third_party/skia/include/images/SkImageDecoder.h"
+#include "third_party/skia/include/images/SkImageEncoder.h"
 
 namespace canvas {
 const SkBitmap::Config skia_config = SkBitmap::kARGB_8888_Config;
@@ -176,7 +177,8 @@
     encode_succeeded = encoder->encodeStream(&output_stream, *skia_bitmap(),
         static_cast<int> (quality * 100));
   } else {
-    encode_succeeded = encoder->encodeStream(&output_stream, *skia_bitmap());
+    encode_succeeded = encoder->encodeStream(&output_stream, *skia_bitmap(),
+        SkImageEncoder::kDefaultQuality);
   }
   if (!encode_succeeded) {
     context->SetException(STRING16(L"Could not encode image."));
==== //depot/googleclient/gears/opensource/gears/canvas/canvas.h#16 - 
c:\devel\srcwingears5/googleclient/gears/opensource/gears/canvas/canvas.h ====
# action=edit type=text
--- googleclient/gears/opensource/gears/canvas/canvas.h 2009-02-11 
11:58:57.000000000 +1100
+++ googleclient/gears/opensource/gears/canvas/canvas.h 2009-02-11 
11:59:58.000000000 +1100
@@ -26,7 +26,7 @@
 #ifndef GEARS_CANVAS_CANVAS_H__
 #define GEARS_CANVAS_CANVAS_H__
 
-#if !defined(OFFICIAL_BUILD) && (defined(WIN32) || defined(OS_MACOSX))
+#if !defined(OFFICIAL_BUILD)
 
 #include "gears/base/common/base_class.h"
 #include "gears/base/common/common.h"
@@ -152,5 +152,5 @@
   DISALLOW_EVIL_CONSTRUCTORS(GearsCanvas);
 };
 
-#endif  // !defined(OFFICIAL_BUILD) && ...
+#endif  // !defined(OFFICIAL_BUILD)
 #endif  // GEARS_CANVAS_CANVAS_H__
==== 
//depot/googleclient/gears/opensource/gears/canvas/canvas_rendering_context_2d.cc#17
 - 
c:\devel\srcwingears5/googleclient/gears/opensource/gears/canvas/canvas_rendering_context_2d.cc
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/canvas/canvas_rendering_context_2d.cc   
2009-02-11 11:58:57.000000000 +1100
+++ googleclient/gears/opensource/gears/canvas/canvas_rendering_context_2d.cc   
2009-02-11 14:42:07.000000000 +1100
@@ -26,7 +26,7 @@
 #include "gears/canvas/canvas_rendering_context_2d.h"
 
 #include "gears/base/common/js_runner.h"
-#include "third_party/skia/include/SkPorterDuff.h"
+#include "third_party/skia/include/core/SkPorterDuff.h"
 
 DECLARE_DISPATCHER(GearsCanvasRenderingContext2D);
 const std::string
==== 
//depot/googleclient/gears/opensource/gears/canvas/canvas_rendering_context_2d.h#12
 - 
c:\devel\srcwingears5/googleclient/gears/opensource/gears/canvas/canvas_rendering_context_2d.h
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/canvas/canvas_rendering_context_2d.h    
2009-02-11 11:58:57.000000000 +1100
+++ googleclient/gears/opensource/gears/canvas/canvas_rendering_context_2d.h    
2009-02-11 12:00:26.000000000 +1100
@@ -26,12 +26,12 @@
 #ifndef GEARS_CANVAS_CANVAS_RENDERING_CONTEXT_2D_H__
 #define GEARS_CANVAS_CANVAS_RENDERING_CONTEXT_2D_H__
 
-#if !defined(OFFICIAL_BUILD) && (defined(WIN32) || defined(OS_MACOSX))
+#if !defined(OFFICIAL_BUILD)
 
 #include "gears/base/common/base_class.h"
 #include "gears/base/common/common.h"
 #include "gears/canvas/canvas.h"
-#include "third_party/skia/include/SkCanvas.h"
+#include "third_party/skia/include/core/SkCanvas.h"
 
 namespace canvas {
 extern const SkBitmap::Config skia_config;
@@ -193,5 +193,5 @@
   DISALLOW_EVIL_CONSTRUCTORS(GearsCanvasRenderingContext2D);
 };
 
-#endif  // !defined(OFFICIAL_BUILD) && ...
+#endif  // !defined(OFFICIAL_BUILD)
 #endif  // GEARS_CANVAS_CANVAS_RENDERING_CONTEXT_2D_H__
==== //depot/googleclient/gears/opensource/gears/factory/factory_impl.cc#25 - 
c:\devel\srcwingears5/googleclient/gears/opensource/gears/factory/factory_impl.cc
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/factory/factory_impl.cc 2009-02-11 
11:58:58.000000000 +1100
+++ googleclient/gears/opensource/gears/factory/factory_impl.cc 2009-02-11 
12:01:24.000000000 +1100
@@ -60,9 +60,7 @@
 // Furthermore, Canvas, Console and Image are unimplemented for all
 // browsers on WinCE.
 #else
-// The Canvas API is temporarily disabled whilst we switch the Skia dependency
-// from being a pre-built binary static library to being built from source.
-// #include "gears/canvas/canvas.h"
+#include "gears/canvas/canvas.h"
 #include "gears/console/console.h"
 #include "gears/image/image_loader.h"
 #endif  // OS_WINCE
@@ -215,10 +213,8 @@
   // Furthermore, Canvas, Console and Image are unimplemented for all
   // browsers on WinCE.
 #else
-// The Canvas API is temporarily disabled whilst we switch the Skia dependency
-// from being a pre-built binary static library to being built from source.
-//   } else if (module_name == STRING16(L"beta.canvas")) {
-//     CreateModule<GearsCanvas>(module_environment_.get(), context, &object);
+   } else if (module_name == STRING16(L"beta.canvas")) {
+     CreateModule<GearsCanvas>(module_environment_.get(), context, &object);
   } else if (module_name == STRING16(L"beta.console")) {
     CreateModule<GearsConsole>(module_environment_.get(), context, &object);
   } else if (module_name == STRING16(L"beta.imageloader")) {
==== //depot/googleclient/gears/opensource/gears/test/manual/canvas.html#1 - 
c:\devel\srcwingears5/googleclient/gears/opensource/gears/test/manual/canvas.html
 ====
# action=add type=text
--- /dev/null   1970-01-01 11:00:00.000000000 +1100
+++ googleclient/gears/opensource/gears/test/manual/canvas.html 2009-02-11 
15:49:07.000000000 +1100
@@ -0,0 +1,30 @@
+<html><head><title>Gears Canvas</title></head>
+<body>
+<h1>Gears Canvas</h1>
+<img id="outputImg" width="100px" height="80px" style="border:1px solid black">
+<script type="text/javascript" src="../../sdk/gears_init.js"></script>
+<script type="text/javascript">
+
+
+var canvas = google.gears.factory.create('beta.canvas');
+canvas.width = 100;
+canvas.height = 80;
+
+var context = canvas.getContext('gears-2d');
+// TODO(nigeltao): Implement context.fillRect.
+
+var blob = canvas.toBlob();
+alert('blob.length = ' + blob.length);
+
+var localServer = google.gears.factory.create('beta.localserver');
+localServer.removeStore("test_manual_canvas");
+var store = localServer.createStore("test_manual_canvas");
+
+var capturedUrl = parseInt(Math.random() * 1000) + '.png';
+store.captureBlob(blob, capturedUrl);
+document.getElementById('outputImg').src = capturedUrl;
+
+
+</script>
+</body>
+</html>
==== //depot/googleclient/gears/opensource/gears/tools/config.mk#100 - 
c:\devel\srcwingears5/googleclient/gears/opensource/gears/tools/config.mk ====
# action=edit type=text
--- googleclient/gears/opensource/gears/tools/config.mk 2009-02-11 
11:58:58.000000000 +1100
+++ googleclient/gears/opensource/gears/tools/config.mk 2009-02-11 
15:49:56.000000000 +1100
@@ -164,6 +164,9 @@
 # Additional include paths for gurl.
 # TODO(cprince): change this to GURL_CFLAGS if we ever define USING_GURL.
 CPPFLAGS += -I../third_party/npapi -I../third_party -I../third_party/googleurl
+
+# Additional include paths for skia.
+CPPFLAGS += -I../third_party/skia/include/core 
-I../third_party/skia/include/images
 
 ICU_CFLAGS += -I../third_party/icu38/public/common
 
@@ -806,6 +809,9 @@
 BREAKPAD_CPPFLAGS += /wd4018 /wd4003
 THIRD_PARTY_CPPFLAGS += /wd4018 /wd4003
 
+# Some more warnings from the Skia library.
+THIRD_PARTY_CPPFLAGS += /wd4244 /wd4800
+
 COMPILE_FLAGS_dbg = /MTd /Zi /Zc:wchar_t-
 COMPILE_FLAGS_opt = /MT  /Zi /Zc:wchar_t- /O2
 COMPILE_FLAGS = /c /Fo"$@" /Fd"$(@D)/$(*F).pdb" /W3 /WX /GR- 
$(COMPILE_FLAGS_$(MODE))
==== //depot/googleclient/gears/opensource/gears/tools/rules.mk#103 - 
c:\devel\srcwingears5/googleclient/gears/opensource/gears/tools/rules.mk ====
# action=edit type=text
--- googleclient/gears/opensource/gears/tools/rules.mk  2009-02-11 
11:58:59.000000000 +1100
+++ googleclient/gears/opensource/gears/tools/rules.mk  2009-02-11 
14:48:43.000000000 +1100
@@ -79,7 +79,7 @@
 #  out_dir/a.o out_dir/foo.o
 # In the macro's body, $1 is the output directory and $2 is the list of source
 # files.
-SOURCECODE_SUFFIXES = c cc m mm s
+SOURCECODE_SUFFIXES = c cc cpp m mm s
 SUBSTITUTE_OBJ_SUFFIX = $(foreach SUFFIX,$(SOURCECODE_SUFFIXES), \
                            $(patsubst %.$(SUFFIX),$1/%$(OBJ_SUFFIX), \
                              $(filter %.$(SUFFIX), $2) \
@@ -705,6 +705,9 @@
 $(THIRD_PARTY_OUTDIR)/%$(OBJ_SUFFIX): %.cc
        @$(MKDEP)
        $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(THIRD_PARTY_CPPFLAGS) 
$(THIRD_PARTY_CXXFLAGS) $<
+$(THIRD_PARTY_OUTDIR)/%$(OBJ_SUFFIX): %.cpp
+       @$(MKDEP)
+       $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(THIRD_PARTY_CPPFLAGS) 
$(THIRD_PARTY_CXXFLAGS) $<
 
 $(VISTA_BROKER_OUTDIR)/%$(OBJ_SUFFIX): %.c
        @$(MKDEP)
@@ -888,6 +891,8 @@
 # Split the list of OBJS to avoid "input line is too long" errors.
 $(BROWSER)_OBJS1 = $(wordlist   1, 100, $($(BROWSER)_OBJS))
 $(BROWSER)_OBJS2 = $(wordlist 101, 999, $($(BROWSER)_OBJS))
+THIRD_PARTY_OBJS1 = $(wordlist 1, 100, $(THIRD_PARTY_OBJS))
+THIRD_PARTY_OBJS2 = $(wordlist 101, 999, $(THIRD_PARTY_OBJS))
 
 # WARNING: Must keep the following two rules (FF2|FF3_MODULE_DLL) in sync!
 # The only difference should be the rule name.
@@ -902,7 +907,8 @@
        $(ECHO) $(COMMON_OBJS) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
        $(ECHO) $(LIBGD_OBJS) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
        $(ECHO) $(SQLITE_OBJS) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
-       $(ECHO) $(THIRD_PARTY_OBJS) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
+       $(ECHO) $(THIRD_PARTY_OBJS1) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
+       $(ECHO) $(THIRD_PARTY_OBJS2) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
        $(MKDLL) $(DLLFLAGS) $($(BROWSER)_DLLFLAGS) $($(BROWSER)_LINK_EXTRAS) 
$($(BROWSER)_LIBS) $(EXT_LINKER_CMD_FLAG)$(OUTDIR)/obj_list.temp
        rm $(OUTDIR)/obj_list.temp
   endif
@@ -917,7 +923,8 @@
        $(ECHO) $(COMMON_OBJS) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
        $(ECHO) $(LIBGD_OBJS) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
        $(ECHO) $(SQLITE_OBJS) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
-       $(ECHO) $(THIRD_PARTY_OBJS) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
+       $(ECHO) $(THIRD_PARTY_OBJS1) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
+       $(ECHO) $(THIRD_PARTY_OBJS2) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
        $(MKDLL) $(DLLFLAGS) $($(BROWSER)_DLLFLAGS) $($(BROWSER)_LINK_EXTRAS) 
$($(BROWSER)_LIBS) $(EXT_LINKER_CMD_FLAG)$(OUTDIR)/obj_list.temp
        rm $(OUTDIR)/obj_list.temp
   endif
@@ -936,7 +943,8 @@
        $(ECHO) $(COMMON_OBJS) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
        $(ECHO) $(LIBGD_OBJS) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
        $(ECHO) $(SQLITE_OBJS) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
-       $(ECHO) $(THIRD_PARTY_OBJS) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
+       $(ECHO) $(THIRD_PARTY_OBJS1) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
+       $(ECHO) $(THIRD_PARTY_OBJS2) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
        $(MKDLL) $(DLLFLAGS) $($(BROWSER)_DLLFLAGS) $($(BROWSER)_LINK_EXTRAS) 
$($(BROWSER)_LIBS) $(EXT_LINKER_CMD_FLAG)$(OUTDIR)/obj_list.temp
        rm $(OUTDIR)/obj_list.temp
 
@@ -951,7 +959,8 @@
        $(ECHO) $(COMMON_OBJS) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
        $(ECHO) $(LIBGD_OBJS) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
        $(ECHO) $(SQLITE_OBJS) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
-       $(ECHO) $(THIRD_PARTY_OBJS) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
+       $(ECHO) $(THIRD_PARTY_OBJS1) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
+       $(ECHO) $(THIRD_PARTY_OBJS2) | $(TRANSLATE_LINKER_FILE_LIST) >> 
$(OUTDIR)/obj_list.temp
        $(MKDLL) $(DLLFLAGS) $($(BROWSER)_DLLFLAGS) $($(BROWSER)_LINK_EXTRAS) 
$($(BROWSER)_LIBS) $(EXT_LINKER_CMD_FLAG)$(OUTDIR)/obj_list.temp
        rm $(OUTDIR)/obj_list.temp
 
==== //depot/googleclient/gears/opensource/third_party/skia/README.google#1 - 
c:\devel\srcwingears5/googleclient/gears/opensource/third_party/skia/README.google
 ====
# action=edit type=text
--- googleclient/gears/opensource/third_party/skia/README.google        
2009-02-11 11:58:59.000000000 +1100
+++ googleclient/gears/opensource/third_party/skia/README.google        
2009-02-11 14:50:34.000000000 +1100
@@ -3,3 +3,32 @@
   svn checkout http://skia.googlecode.com/svn/trunk/ skia-read-only
 as directed by the instructions at
   http://code.google.com/p/skia/source/checkout
+plus the following changes:
+
+
+skia/include/core/SkUserConfig.h lines 20-42 were added to set Gears-specific
+build configuration options, based on Chromium's Skia/Win32 edits visible at
+http://src.chromium.org/viewvc/chrome/trunk/src/skia/include/corecg/SkUserConfig.h
+
+
+skia/src/core/SkFP.h line 44 was changed from
+...0.33333333333...
+to
+...0.33333333333f...
+in order to disambiguate the various pow(...) implementations on the Win32
+build (i.e. the (float,float) version from the (double,double) version).
+
+
+skia/src/images/SkImageDecoder_libjpeg.cpp lines 28-29 and
+skia/src/images/SkImageDecoder_libpng.cpp line 30 were changed to add
+"third_party/libjpeg/" and "third_party/libpng/" to the #include calls.
+
+
+skia/src/ports/SkFontHost_win.cpp lines 28-29 disabled CAN_USE_LOGFONT_NAME
+since it causes a compile error (since Gears uses 16-bit TCHARs and presumably
+Skia/Win32 is usually built with 8-bit TCHARs).
+
+
+skia/src/ports/gears_skia_win_fixes.cpp implements empty stubs for a number
+of functions declared in Skia's .h files but are missing from Skia's Windows
+port (which is presumably a work-in-progress).
\ No newline at end of file
==== 
//depot/googleclient/gears/opensource/third_party/skia/include/core/SkUserConfig.h#1
 - 
c:\devel\srcwingears5/googleclient/gears/opensource/third_party/skia/include/core/SkUserConfig.h
 ====
# action=edit type=text
--- googleclient/gears/opensource/third_party/skia/include/core/SkUserConfig.h  
2009-02-11 14:44:13.000000000 +1100
+++ googleclient/gears/opensource/third_party/skia/include/core/SkUserConfig.h  
2009-02-11 14:40:17.000000000 +1100
@@ -16,6 +16,30 @@
 
 #ifndef SkUserConfig_DEFINED
 #define SkUserConfig_DEFINED
+
+// BEGIN Gears changes, a la Chromium's src/skia/include/corecg/SkUserConfig.h
+#ifdef WIN32
+
+#define SK_IGNORE_STDINT_DOT_H
+
+typedef signed char int8_t;
+typedef unsigned char uint8_t;
+typedef short int16_t;
+typedef unsigned short uint16_t;
+typedef int int32_t;
+typedef unsigned int uint32_t;
+
+// Skia uses this deprecated bzero function to fill zeros into a string.
+#define bzero(str, len) memset(str, 0, len)
+
+// Non-gcc compilers don't speak __restrict__.
+#ifdef SK_RESTRICT
+  #undef SK_RESTRICT
+  #define SK_RESTRICT
+#endif
+
+#endif  // WIN32
+// END Gears changes
 
 /*  SkTypes.h, the root of the public header files, does the following trick:
  
==== //depot/googleclient/gears/opensource/third_party/skia/src/core/SkFP.h#1 - 
c:\devel\srcwingears5/googleclient/gears/opensource/third_party/skia/src/core/SkFP.h
 ====
# action=edit type=text
--- googleclient/gears/opensource/third_party/skia/src/core/SkFP.h      
2009-02-11 14:44:13.000000000 +1100
+++ googleclient/gears/opensource/third_party/skia/src/core/SkFP.h      
2009-02-11 12:41:36.000000000 +1100
@@ -41,7 +41,7 @@
     #define SkFPDivInt(a, n)        ((a) / (n))
     #define SkFPInvert(x)           SkScalarInvert(x)
     #define SkFPSqrt(x)             SkScalarSqrt(x)
-    #define SkFPCubeRoot(x)         static_cast<float>(pow(x, 0.33333333333))
+    #define SkFPCubeRoot(x)         static_cast<float>(pow(x, 0.33333333333f))
 
     #define SkFPLT(a, b)            ((a) < (b))
     #define SkFPLE(a, b)            ((a) <= (b))
==== 
//depot/googleclient/gears/opensource/third_party/skia/src/images/SkImageDecoder_libjpeg.cpp#1
 - 
c:\devel\srcwingears5/googleclient/gears/opensource/third_party/skia/src/images/SkImageDecoder_libjpeg.cpp
 ====
# action=edit type=text
--- 
googleclient/gears/opensource/third_party/skia/src/images/SkImageDecoder_libjpeg.cpp
        2009-02-11 14:44:14.000000000 +1100
+++ 
googleclient/gears/opensource/third_party/skia/src/images/SkImageDecoder_libjpeg.cpp
        2009-02-11 12:55:31.000000000 +1100
@@ -25,8 +25,8 @@
 
 #include <stdio.h>
 extern "C" {
-    #include "jpeglib.h"
-    #include "jerror.h"
+    #include "third_party/libjpeg/jpeglib.h"
+    #include "third_party/libjpeg/jerror.h"
 }
 
 // this enables timing code to report milliseconds for an encode
==== 
//depot/googleclient/gears/opensource/third_party/skia/src/images/SkImageDecoder_libpng.cpp#1
 - 
c:\devel\srcwingears5/googleclient/gears/opensource/third_party/skia/src/images/SkImageDecoder_libpng.cpp
 ====
# action=edit type=text
--- 
googleclient/gears/opensource/third_party/skia/src/images/SkImageDecoder_libpng.cpp
 2009-02-11 11:59:00.000000000 +1100
+++ 
googleclient/gears/opensource/third_party/skia/src/images/SkImageDecoder_libpng.cpp
 2009-02-11 12:02:15.000000000 +1100
@@ -27,7 +27,7 @@
 #include "SkUtils.h"
 
 extern "C" {
-#include "png.h"
+#include "third_party/libpng/png.h"
 }
 
 class SkPNGImageDecoder : public SkImageDecoder {
==== 
//depot/googleclient/gears/opensource/third_party/skia/src/ports/SkFontHost_win.cpp#1
 - 
c:\devel\srcwingears5/googleclient/gears/opensource/third_party/skia/src/ports/SkFontHost_win.cpp
 ====
# action=edit type=text
--- googleclient/gears/opensource/third_party/skia/src/ports/SkFontHost_win.cpp 
2009-02-11 14:44:14.000000000 +1100
+++ googleclient/gears/opensource/third_party/skia/src/ports/SkFontHost_win.cpp 
2009-02-11 13:55:32.000000000 +1100
@@ -25,8 +25,8 @@
 #include "windows.h"
 #include "tchar.h"
 
-// client3d has to undefine this for now
-#define CAN_USE_LOGFONT_NAME
+// client3d has to undefine this for now (and so does Gears)
+//#define CAN_USE_LOGFONT_NAME
 
 static SkMutex gFTMutex;
 
==== 
//depot/googleclient/gears/opensource/third_party/skia/src/ports/gears_skia_win_fixes.cpp#1
 - 
c:\devel\srcwingears5/googleclient/gears/opensource/third_party/skia/src/ports/gears_skia_win_fixes.cpp
 ====
# action=add type=text
--- /dev/null   1970-01-01 11:00:00.000000000 +1100
+++ 
googleclient/gears/opensource/third_party/skia/src/ports/gears_skia_win_fixes.cpp
   2009-02-11 14:54:57.000000000 +1100
@@ -0,0 +1,55 @@
+// Copyright 2009, Google Inc.
+//
+// Patches to Skia r89 in order to make Gears + Skia build on Windows.
+//
+// The Windows port seems incomplete (e.g. file operations aren't implemented)
+// but Gears won't use these functions anyway (e.g. Gears only reads images
+// from GearsBlobs, not from files directly, and SkTime::GetMSecs is only used
+// by Skia for debugging/profiling), and so Gears instead provides these empty
+// stubs below.
+
+#include "SkFontHost.h"
+#include "SkOSFile.h"
+#include "SkTime.h"
+
+SkTypeface* SkFontHost::CreateTypefaceFromFile(char const*) {
+  SkASSERT(!"Unimplemented");
+  return NULL;
+}
+
+SkMSec SkTime::GetMSecs() {
+  return 0;
+}
+
+void sk_fclose(SkFILE* f) {
+  SkASSERT(!"Unimplemented");
+}
+
+void sk_fflush(SkFILE* f) {
+  SkASSERT(!"Unimplemented");
+}
+
+size_t sk_fgetsize(SkFILE* f) {
+  SkASSERT(!"Unimplemented");
+  return 0;
+}
+
+SkFILE* sk_fopen(const char path[], SkFILE_Flags flags) {
+  SkASSERT(!"Unimplemented");
+  return NULL;
+}
+
+size_t sk_fread(void* buffer, size_t byteCount, SkFILE* f) {
+  SkASSERT(!"Unimplemented");
+  return 0;
+}
+
+bool sk_frewind(SkFILE* f) {
+  SkASSERT(!"Unimplemented");
+  return false;
+}
+
+size_t sk_fwrite(const void* buffer, size_t byteCount, SkFILE* f) {
+  SkASSERT(!"Unimplemented");
+  return 0;
+}
\ No newline at end of file

Reply via email to