Revert "Serialization of SkPictureImageFilter"
authorfmalita@google.com <fmalita@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 7 Feb 2014 05:55:39 +0000 (05:55 +0000)
committerfmalita@google.com <fmalita@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 7 Feb 2014 05:55:39 +0000 (05:55 +0000)
This reverts commit 227321b30106e57942929eb96fa5bc22544f6c9e.

Revert "Sanitizing source files in Housekeeper-Nightly"

This reverts commit baf28584b7636c01355f8d8d972e06aa7fb66d77.

TBR=robertphillips@google.com,sugoi@google.com

Review URL: https://codereview.chromium.org/153583007

git-svn-id: http://skia.googlecode.com/svn/trunk@13356 2bbb7eff-a529-9590-31e7-b0007b416f81

13 files changed:
gm/colorfilters.cpp
include/core/SkImage.h
include/core/SkPicture.h
include/effects/SkColorMatrix.h
include/effects/SkPictureImageFilter.h
samplecode/SampleFilterFuzz.cpp
src/core/SkPicture.cpp
src/core/SkPicturePlayback.cpp
src/core/SkPicturePlayback.h
src/effects/SkPictureImageFilter.cpp
src/image/SkImage.cpp
tests/MatrixClipCollapseTest.cpp
tests/SurfaceTest.cpp

index 45e975e..4246d69 100644 (file)
@@ -85,3 +85,4 @@ private:
 //////////////////////////////////////////////////////////////////////////////
 
 DEF_GM( return SkNEW(ColorFiltersGM); )
+
index c9f9396..2353655 100644 (file)
@@ -85,7 +85,7 @@ public:
      *  ignored.
      */
     const void* peekPixels(SkImageInfo* info, size_t* rowBytes) const;
-
+    
     /**
      *  Encode the image's pixels and return the result as a new SkData, which
      *  the caller must manage (i.e. call unref() when they are done).
index a717153..82d6835 100644 (file)
@@ -68,16 +68,6 @@ public:
     static SkPicture* CreateFromStream(SkStream*,
                                        InstallPixelRefProc proc = &SkImageDecoder::DecodeMemory);
 
-    /**
-     *  Recreate a picture that was serialized into a buffer. If the creation requires bitmap
-     *  decoding, the decoder must be set on the SkReadBuffer parameter by calling
-     *  SkReadBuffer::setBitmapDecoder() before calling SkPicture::CreateFromBuffer().
-     *  @param SkReadBuffer Serialized picture data.
-     *  @return A new SkPicture representing the serialized data, or NULL if the buffer is
-     *          invalid.
-     */
-    static SkPicture* CreateFromBuffer(SkReadBuffer&);
-
     virtual ~SkPicture();
 
     /**
@@ -197,11 +187,6 @@ public:
     void serialize(SkWStream*, EncodeBitmap encoder = NULL) const;
 
     /**
-     *  Serialize to a buffer.
-     */
-    void flatten(SkWriteBuffer&) const;
-
-    /**
      * Returns true if any bitmaps may be produced when this SkPicture
      * is replayed.
      * Returns false if called while still recording.
@@ -238,8 +223,7 @@ protected:
     // V17: SkPixelRef now writes SkImageInfo
     // V18: SkBitmap now records x,y for its pixelref origin, instead of offset.
     // V19: encode matrices and regions into the ops stream
-    // V20: added bool to SkPictureImageFilter's serialization (to allow SkPicture serialization)
-    static const uint32_t PICTURE_VERSION = 20;
+    static const uint32_t PICTURE_VERSION = 19;
 
     // fPlayback, fRecord, fWidth & fHeight are protected to allow derived classes to
     // install their own SkPicturePlayback-derived players,SkPictureRecord-derived
@@ -261,10 +245,7 @@ protected:
     // will be ready to be parsed to create an SkPicturePlayback.
     // If false is returned, SkPictInfo is unmodified.
     static bool StreamIsSKP(SkStream*, SkPictInfo*);
-    static bool BufferIsSKP(SkReadBuffer&, SkPictInfo*);
 private:
-    void createHeader(void* header) const;
-
     friend class SkFlatPicture;
     friend class SkPicturePlayback;
 
index c598a12..8ff45f9 100644 (file)
@@ -19,7 +19,7 @@ public:
         kG_Scale    = 6,
         kB_Scale    = 12,
         kA_Scale    = 18,
-
+        
         kR_Trans    = 4,
         kG_Trans    = 9,
         kB_Trans    = 14,
index a10d23e..eeaf1d2 100644 (file)
@@ -28,13 +28,7 @@ public:
 
 protected:
     virtual ~SkPictureImageFilter();
-    /*  Constructs an SkPictureImageFilter object from an SkReadBuffer.
-     *  Note: If the SkPictureImageFilter object construction requires bitmap
-     *  decoding, the decoder must be set on the SkReadBuffer parameter by calling
-     *  SkReadBuffer::setBitmapDecoder() before calling this constructor.
-     *  @param SkReadBuffer Serialized picture data.
-     */
-    explicit SkPictureImageFilter(SkReadBuffer&);
+    explicit SkPictureImageFilter(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
     virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
                                SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
index 4ef7d40..f77f3b8 100644 (file)
@@ -184,30 +184,6 @@ static const SkBitmap& make_bitmap() {
     return bitmap[R(2)];
 }
 
-#ifdef SK_ALLOW_PICTUREIMAGEFILTER_SERIALIZATION
-static void drawSomething(SkCanvas* canvas) {
-    SkPaint paint;
-
-    canvas->save();
-    canvas->scale(0.5f, 0.5f);
-    canvas->drawBitmap(make_bitmap(), 0, 0, NULL);
-    canvas->restore();
-
-    const char beforeStr[] = "before circle";
-    const char afterStr[] = "after circle";
-
-    paint.setAntiAlias(true);
-
-    paint.setColor(SK_ColorRED);
-    canvas->drawData(beforeStr, sizeof(beforeStr));
-    canvas->drawCircle(SkIntToScalar(kBitmapSize/2), SkIntToScalar(kBitmapSize/2), SkIntToScalar(kBitmapSize/3), paint);
-    canvas->drawData(afterStr, sizeof(afterStr));
-    paint.setColor(SK_ColorBLACK);
-    paint.setTextSize(SkIntToScalar(kBitmapSize/3));
-    canvas->drawText("Picture", 7, SkIntToScalar(kBitmapSize/2), SkIntToScalar(kBitmapSize/4), paint);
-}
-#endif
-
 static SkImageFilter* make_image_filter(bool canBeNull = true) {
     SkImageFilter* filter = 0;
 
@@ -318,16 +294,7 @@ static SkImageFilter* make_image_filter(bool canBeNull = true) {
         filter = new SkTileImageFilter(make_rect(), make_rect(), make_image_filter(false));
         break;
     case PICTURE:
-    {
-        SkPicture* pict = NULL;
-#ifdef SK_ALLOW_PICTUREIMAGEFILTER_SERIALIZATION
-        pict = new SkPicture;
-        SkAutoUnref aur(pict);
-        drawSomething(pict->beginRecording(kBitmapSize, kBitmapSize));
-        pict->endRecording();
-#endif
-        filter = new SkPictureImageFilter(pict, make_rect());
-    }
+        filter = new SkPictureImageFilter(NULL, make_rect());
         break;
     default:
         break;
index e226c26..ca1b6fa 100644 (file)
@@ -265,7 +265,6 @@ void SkPicture::draw(SkCanvas* surface, SkDrawPictureCallback* callback) {
 #include "SkStream.h"
 
 static const char kMagic[] = { 's', 'k', 'i', 'a', 'p', 'i', 'c', 't' };
-static const size_t kHeaderSize = sizeof(kMagic) + sizeof(SkPictInfo);
 
 bool SkPicture::StreamIsSKP(SkStream* stream, SkPictInfo* pInfo) {
     if (NULL == stream) {
@@ -274,8 +273,8 @@ bool SkPicture::StreamIsSKP(SkStream* stream, SkPictInfo* pInfo) {
 
     // Check magic bytes.
     char magic[sizeof(kMagic)];
-    if (!stream->read(magic, sizeof(kMagic)) ||
-        (0 != memcmp(magic, kMagic, sizeof(kMagic)))) {
+    stream->read(magic, sizeof(kMagic));
+    if (0 != memcmp(magic, kMagic, sizeof(kMagic))) {
         return false;
     }
 
@@ -294,30 +293,6 @@ bool SkPicture::StreamIsSKP(SkStream* stream, SkPictInfo* pInfo) {
     return true;
 }
 
-bool SkPicture::BufferIsSKP(SkReadBuffer& buffer, SkPictInfo* pInfo) {
-    // Check magic bytes.
-    char magic[sizeof(kMagic)];
-
-    if (!buffer.readByteArray(magic, sizeof(kMagic)) ||
-        (0 != memcmp(magic, kMagic, sizeof(kMagic)))) {
-        return false;
-    }
-
-    SkPictInfo info;
-    if (!buffer.readByteArray(&info, sizeof(SkPictInfo))) {
-        return false;
-    }
-
-    if (PICTURE_VERSION != info.fVersion) {
-        return false;
-    }
-
-    if (pInfo != NULL) {
-        *pInfo = info;
-    }
-    return true;
-}
-
 SkPicture::SkPicture(SkPicturePlayback* playback, int width, int height)
     : fPlayback(playback)
     , fRecord(NULL)
@@ -345,56 +320,31 @@ SkPicture* SkPicture::CreateFromStream(SkStream* stream, InstallPixelRefProc pro
     return SkNEW_ARGS(SkPicture, (playback, info.fWidth, info.fHeight));
 }
 
-SkPicture* SkPicture::CreateFromBuffer(SkReadBuffer& buffer) {
-    SkPictInfo info;
-
-    if (!BufferIsSKP(buffer, &info)) {
-        return NULL;
-    }
+void SkPicture::serialize(SkWStream* stream, EncodeBitmap encoder) const {
+    SkPicturePlayback* playback = fPlayback;
 
-    SkPicturePlayback* playback;
-    // Check to see if there is a playback to recreate.
-    if (buffer.readBool()) {
-        playback = SkPicturePlayback::CreateFromBuffer(buffer);
-        if (NULL == playback) {
-            return NULL;
-        }
-    } else {
-        playback = NULL;
+    if (NULL == playback && fRecord) {
+        playback = SkNEW_ARGS(SkPicturePlayback, (*fRecord));
     }
 
-    return SkNEW_ARGS(SkPicture, (playback, info.fWidth, info.fHeight));
-}
+    SkPictInfo info;
 
-void SkPicture::createHeader(void* header) const {
-    // Copy magic bytes at the beginning of the header
-    SkASSERT(sizeof(kMagic) == 8);
-    memcpy(header, kMagic, sizeof(kMagic));
-
-    // Set piture info after magic bytes in the header
-    SkPictInfo* info = (SkPictInfo*)(((char*)header) + sizeof(kMagic));
-    info->fVersion = PICTURE_VERSION;
-    info->fWidth = fWidth;
-    info->fHeight = fHeight;
-    info->fFlags = SkPictInfo::kCrossProcess_Flag;
+    info.fVersion = PICTURE_VERSION;
+    info.fWidth = fWidth;
+    info.fHeight = fHeight;
+    info.fFlags = SkPictInfo::kCrossProcess_Flag;
     // TODO: remove this flag, since we're always float (now)
-    info->fFlags |= SkPictInfo::kScalarIsFloat_Flag;
+    info.fFlags |= SkPictInfo::kScalarIsFloat_Flag;
 
     if (8 == sizeof(void*)) {
-        info->fFlags |= SkPictInfo::kPtrIs64Bit_Flag;
+        info.fFlags |= SkPictInfo::kPtrIs64Bit_Flag;
     }
-}
-
-void SkPicture::serialize(SkWStream* stream, EncodeBitmap encoder) const {
-    SkPicturePlayback* playback = fPlayback;
 
-    if (NULL == playback && fRecord) {
-        playback = SkNEW_ARGS(SkPicturePlayback, (*fRecord));
-    }
+    // Write 8 magic bytes to ID this file format.
+    SkASSERT(sizeof(kMagic) == 8);
+    stream->write(kMagic, sizeof(kMagic));
 
-    char header[kHeaderSize];
-    createHeader(&header);
-    stream->write(header, kHeaderSize);
+    stream->write(&info, sizeof(info));
     if (playback) {
         stream->writeBool(true);
         playback->serialize(stream, encoder);
@@ -407,28 +357,6 @@ void SkPicture::serialize(SkWStream* stream, EncodeBitmap encoder) const {
     }
 }
 
-void SkPicture::flatten(SkWriteBuffer& buffer) const {
-    SkPicturePlayback* playback = fPlayback;
-
-    if (NULL == playback && fRecord) {
-        playback = SkNEW_ARGS(SkPicturePlayback, (*fRecord));
-    }
-
-    char header[kHeaderSize];
-    createHeader(&header);
-    buffer.writeByteArray(header, kHeaderSize);
-    if (playback) {
-        buffer.writeBool(true);
-        playback->flatten(buffer);
-        // delete playback if it is a local version (i.e. cons'd up just now)
-        if (playback != fPlayback) {
-            SkDELETE(playback);
-        }
-    } else {
-        buffer.writeBool(false);
-    }
-}
-
 bool SkPicture::willPlayBackBitmaps() const {
     if (!fPlayback) return false;
     return fPlayback->containsBitmaps();
index 8b8c6b0..e71a17f 100644 (file)
@@ -431,22 +431,6 @@ void SkPicturePlayback::serialize(SkWStream* stream,
     stream->write32(PICT_EOF_TAG);
 }
 
-void SkPicturePlayback::flatten(SkWriteBuffer& buffer) const {
-    writeTagSize(buffer, PICT_READER_TAG, fOpData->size());
-    buffer.writeByteArray(fOpData->bytes(), fOpData->size());
-
-    if (fPictureCount > 0) {
-        writeTagSize(buffer, PICT_PICTURE_TAG, fPictureCount);
-        for (int i = 0; i < fPictureCount; i++) {
-            fPictureRefs[i]->flatten(buffer);
-        }
-    }
-
-    // Write this picture playback's data into a writebuffer
-    this->flattenToBuffer(buffer);
-    buffer.write32(PICT_EOF_TAG);
-}
-
 ///////////////////////////////////////////////////////////////////////////////
 
 /**
@@ -609,15 +593,6 @@ SkPicturePlayback* SkPicturePlayback::CreateFromStream(SkStream* stream,
     return playback.detach();
 }
 
-SkPicturePlayback* SkPicturePlayback::CreateFromBuffer(SkReadBuffer& buffer) {
-    SkAutoTDelete<SkPicturePlayback> playback(SkNEW(SkPicturePlayback));
-
-    if (!playback->parseBuffer(buffer)) {
-        return NULL;
-    }
-    return playback.detach();
-}
-
 bool SkPicturePlayback::parseStream(SkStream* stream, const SkPictInfo& info,
                                     SkPicture::InstallPixelRefProc proc) {
     for (;;) {
@@ -634,21 +609,6 @@ bool SkPicturePlayback::parseStream(SkStream* stream, const SkPictInfo& info,
     return true;
 }
 
-bool SkPicturePlayback::parseBuffer(SkReadBuffer& buffer) {
-    for (;;) {
-        uint32_t tag = buffer.readUInt();
-        if (PICT_EOF_TAG == tag) {
-            break;
-        }
-
-        uint32_t size = buffer.readUInt();
-        if (!this->parseBufferTag(buffer, tag, size)) {
-            return false; // we're invalid
-        }
-    }
-    return true;
-}
-
 ///////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////
 
index 909488b..efa6722 100644 (file)
@@ -64,14 +64,12 @@ public:
     explicit SkPicturePlayback(const SkPictureRecord& record, bool deepCopy = false);
     static SkPicturePlayback* CreateFromStream(SkStream*, const SkPictInfo&,
                                                SkPicture::InstallPixelRefProc);
-    static SkPicturePlayback* CreateFromBuffer(SkReadBuffer&);
 
     virtual ~SkPicturePlayback();
 
     void draw(SkCanvas& canvas, SkDrawPictureCallback*);
 
     void serialize(SkWStream*, SkPicture::EncodeBitmap) const;
-    void flatten(SkWriteBuffer&) const;
 
     void dumpSize() const;
 
@@ -86,7 +84,6 @@ public:
 protected:
     bool parseStream(SkStream*, const SkPictInfo&,
                      SkPicture::InstallPixelRefProc);
-    bool parseBuffer(SkReadBuffer& buffer);
 #ifdef SK_DEVELOPER
     virtual bool preDraw(int opIndex, int type);
     virtual void postDraw(int opIndex);
index 6e76231..c78b249 100644 (file)
@@ -34,27 +34,13 @@ SkPictureImageFilter::~SkPictureImageFilter() {
 SkPictureImageFilter::SkPictureImageFilter(SkReadBuffer& buffer)
   : INHERITED(0, buffer),
     fPicture(NULL) {
-#ifdef SK_ALLOW_PICTUREIMAGEFILTER_SERIALIZATION
-    if (buffer.readBool()) {
-        fPicture = SkPicture::CreateFromBuffer(buffer);
-    }
-#else
-    buffer.readBool();
-#endif
+    // FIXME: unflatten picture here.
     buffer.readRect(&fRect);
 }
 
 void SkPictureImageFilter::flatten(SkWriteBuffer& buffer) const {
     this->INHERITED::flatten(buffer);
-#ifdef SK_ALLOW_PICTUREIMAGEFILTER_SERIALIZATION
-    bool hasPicture = (fPicture != NULL);
-    buffer.writeBool(hasPicture);
-    if (hasPicture) {
-        fPicture->flatten(buffer);
-    }
-#else
-    buffer.writeBool(false);
-#endif
+    // FIXME: flatten picture here.
     buffer.writeRect(fRect);
 }
 
index a567c41..9b0a0b2 100644 (file)
@@ -55,7 +55,7 @@ bool SkImage::readPixels(SkBitmap* bitmap, const SkIRect* subset) const {
     if (NULL == bitmap) {
         return false;
     }
-
+    
     SkIRect bounds = SkIRect::MakeWH(this->width(), this->height());
 
     // trim against the bitmap, if its already been allocated
@@ -126,7 +126,7 @@ bool SkImage_Base::onReadPixels(SkBitmap* bitmap, const SkIRect& subset) const {
     srcR.set(subset);
     dstR = srcR;
     dstR.offset(-dstR.left(), -dstR.top());
-
+    
     SkCanvas canvas(*bitmap);
 
     SkPaint paint;
@@ -136,3 +136,4 @@ bool SkImage_Base::onReadPixels(SkBitmap* bitmap, const SkIRect& subset) const {
     const_cast<SkImage_Base*>(this)->onDrawRectToRect(&canvas, &srcR, dstR, NULL);
     return true;
 }
+
index d650750..779f387 100644 (file)
@@ -20,7 +20,7 @@
 // Structure methods only directly emit save and restores but call the
 // ModelClip and Body helper methods to fill in the structure. Since they only
 // emit saves and restores the operations emitted by the structure methods will
-// be completely removed by the matrix/clip collapse. Note: every save in
+// be completely removed by the matrix/clip collapse. Note: every save in 
 // a structure method is followed by a call to a ModelClip helper.
 //
 // Body methods only directly emit draw ops and saveLayer/restore pairs but call
@@ -30,7 +30,7 @@
 // followed by a call to a ModelClip helper.
 //
 // The ModelClip methods output matrix and clip ops in various orders and
-// combinations. They contribute to the expected result by outputting the
+// combinations. They contribute to the expected result by outputting the 
 // expected matrix & clip ops. Note that, currently, the entire clip stack
 // is output for each MC state so the clip operations accumulate down the
 // save/restore stack.
@@ -41,7 +41,7 @@
 //        operations' offsets point to the correct follow-on operations. This
 //        could be difficult since there is no good way to communicate the
 //        offset stored in the SkPicture to the debugger's clip objects
-//   add comparison of rendered before & after images?
+//   add comparison of rendered before & after images? 
 //      - not sure if this would be useful since it somewhat duplicates the
 //        correctness test of running render_pictures in record mode and
 //        rendering before and after images. Additionally the matrix/clip collapse
@@ -131,14 +131,14 @@ enum DrawOpType {
 
 static const int kDrawOpTypeCount = kLast_DrawOpType + 1;
 
-typedef void (*PFEmitMC)(SkCanvas* canvas, MatType mat, ClipType clip,
-                         DrawOpType draw, SkTDArray<DrawType>* expected,
+typedef void (*PFEmitMC)(SkCanvas* canvas, MatType mat, ClipType clip, 
+                         DrawOpType draw, SkTDArray<DrawType>* expected, 
                          int accumulatedClips);
-typedef void (*PFEmitBody)(SkCanvas* canvas, PFEmitMC emitMC, MatType mat,
-                           ClipType clip, DrawOpType draw,
+typedef void (*PFEmitBody)(SkCanvas* canvas, PFEmitMC emitMC, MatType mat, 
+                           ClipType clip, DrawOpType draw, 
                            SkTDArray<DrawType>* expected, int accumulatedClips);
-typedef void (*PFEmitStruct)(SkCanvas* canvas, PFEmitMC emitMC, MatType mat,
-                             ClipType clip, PFEmitBody emitBody, DrawOpType draw,
+typedef void (*PFEmitStruct)(SkCanvas* canvas, PFEmitMC emitMC, MatType mat, 
+                             ClipType clip, PFEmitBody emitBody, DrawOpType draw, 
                              SkTDArray<DrawType>* expected);
 
 //////////////////////////////////////////////////////////////////////////////
@@ -261,7 +261,7 @@ static void add_mat(MatType mat, SkTDArray<DrawType>* expected) {
     case kSkew_MatType:         // fall thru
     case kRotate_MatType:       // fall thru
     case kConcat_MatType:       // fall thru
-    case kSetMatrix_MatType:
+    case kSetMatrix_MatType:    
         // TODO: this system currently converts a setMatrix to concat. If we wanted to
         // really preserve the setMatrix semantics we should keep it a setMatrix. I'm
         // not sure if this is a good idea though since this would keep things like pinch
@@ -271,7 +271,7 @@ static void add_mat(MatType mat, SkTDArray<DrawType>* expected) {
     default:
         SkASSERT(0);
     }
-}
+} 
 
 static void emit_draw(SkCanvas* canvas, DrawOpType draw, SkTDArray<DrawType>* expected) {
     switch (draw) {
@@ -315,8 +315,8 @@ static void emit_draw(SkCanvas* canvas, DrawOpType draw, SkTDArray<DrawType>* ex
 //  clip
 //  matrix
 // Simple case - the clip isn't effect by the matrix
-static void emit_clip_and_mat(SkCanvas* canvas, MatType mat, ClipType clip,
-                              DrawOpType draw, SkTDArray<DrawType>* expected,
+static void emit_clip_and_mat(SkCanvas* canvas, MatType mat, ClipType clip, 
+                              DrawOpType draw, SkTDArray<DrawType>* expected, 
                               int accumulatedClips) {
     if (kNone_DrawOpType == draw) {
         return;
@@ -336,8 +336,8 @@ static void emit_clip_and_mat(SkCanvas* canvas, MatType mat, ClipType clip,
 //  clip
 // Emitting the matrix first is more challenging since the matrix has to be
 // pushed across (i.e., applied to) the clip.
-static void emit_mat_and_clip(SkCanvas* canvas, MatType mat, ClipType clip,
-                              DrawOpType draw, SkTDArray<DrawType>* expected,
+static void emit_mat_and_clip(SkCanvas* canvas, MatType mat, ClipType clip, 
+                              DrawOpType draw, SkTDArray<DrawType>* expected, 
                               int accumulatedClips) {
     if (kNone_DrawOpType == draw) {
         return;
@@ -359,8 +359,8 @@ static void emit_mat_and_clip(SkCanvas* canvas, MatType mat, ClipType clip,
 //  matrix
 //  clip
 // This tests that the matrices and clips coalesce when collapsed
-static void emit_double_mat_and_clip(SkCanvas* canvas, MatType mat, ClipType clip,
-                                     DrawOpType draw, SkTDArray<DrawType>* expected,
+static void emit_double_mat_and_clip(SkCanvas* canvas, MatType mat, ClipType clip, 
+                                     DrawOpType draw, SkTDArray<DrawType>* expected, 
                                      int accumulatedClips) {
     if (kNone_DrawOpType == draw) {
         return;
@@ -390,7 +390,7 @@ static void emit_mat_clip_clip(SkCanvas* canvas, MatType mat, ClipType clip,
     if (kNone_DrawOpType == draw) {
         return;
     }
-
+    
     emit_mat(canvas, mat);
     emit_clip(canvas, clip);
     emit_clip(canvas, clip);
@@ -407,10 +407,10 @@ static void emit_mat_clip_clip(SkCanvas* canvas, MatType mat, ClipType clip,
 // Emit:
 //  matrix & clip calls
 //  draw op
-static void emit_body0(SkCanvas* canvas, PFEmitMC emitMC, MatType mat,
+static void emit_body0(SkCanvas* canvas, PFEmitMC emitMC, MatType mat, 
                        ClipType clip, DrawOpType draw,
                        SkTDArray<DrawType>* expected, int accumulatedClips) {
-    bool needsSaveRestore = kNone_DrawOpType != draw &&
+    bool needsSaveRestore = kNone_DrawOpType != draw && 
                             (kNone_MatType != mat || kNone_ClipType != clip);
 
     if (needsSaveRestore) {
@@ -428,10 +428,10 @@ static void emit_body0(SkCanvas* canvas, PFEmitMC emitMC, MatType mat,
 //  draw op
 //  matrix & clip calls
 //  draw op
-static void emit_body1(SkCanvas* canvas, PFEmitMC emitMC, MatType mat,
+static void emit_body1(SkCanvas* canvas, PFEmitMC emitMC, MatType mat, 
                        ClipType clip, DrawOpType draw,
                        SkTDArray<DrawType>* expected, int accumulatedClips) {
-    bool needsSaveRestore = kNone_DrawOpType != draw &&
+    bool needsSaveRestore = kNone_DrawOpType != draw && 
                             (kNone_MatType != mat || kNone_ClipType != clip);
 
     if (needsSaveRestore) {
@@ -456,10 +456,10 @@ static void emit_body1(SkCanvas* canvas, PFEmitMC emitMC, MatType mat,
 //      matrix & clip calls
 //      draw op
 //  Restore
-static void emit_body2(SkCanvas* canvas, PFEmitMC emitMC, MatType mat,
+static void emit_body2(SkCanvas* canvas, PFEmitMC emitMC, MatType mat, 
                        ClipType clip, DrawOpType draw,
                        SkTDArray<DrawType>* expected, int accumulatedClips) {
-    bool needsSaveRestore = kNone_DrawOpType != draw &&
+    bool needsSaveRestore = kNone_DrawOpType != draw && 
                             (kNone_MatType != mat || kNone_ClipType != clip);
 
     if (needsSaveRestore) {
@@ -492,13 +492,13 @@ static void emit_body2(SkCanvas* canvas, PFEmitMC emitMC, MatType mat,
 //      Restore
 //      matrix & clip calls (will be ignored)
 //  Restore
-static void emit_body3(SkCanvas* canvas, PFEmitMC emitMC, MatType mat,
+static void emit_body3(SkCanvas* canvas, PFEmitMC emitMC, MatType mat, 
                        ClipType clip, DrawOpType draw,
                        SkTDArray<DrawType>* expected, int accumulatedClips) {
-    bool needsSaveRestore = kNone_DrawOpType != draw &&
+    bool needsSaveRestore = kNone_DrawOpType != draw && 
                             (kNone_MatType != mat || kNone_ClipType != clip);
 
-    // This saveLayer will always be forced b.c. we currently can't tell
+    // This saveLayer will always be forced b.c. we currently can't tell 
     // ahead of time if it will be empty (see comment in SkMatrixClipStateMgr::save)
     *expected->append() = SAVE_LAYER;
 
@@ -536,7 +536,7 @@ static void emit_body3(SkCanvas* canvas, PFEmitMC emitMC, MatType mat,
 //      some body
 //  Restore
 // Note: the outer save/restore are provided by beginRecording/endRecording
-static void emit_struct0(SkCanvas* canvas,
+static void emit_struct0(SkCanvas* canvas, 
                          PFEmitMC emitMC, MatType mat, ClipType clip,
                          PFEmitBody emitBody, DrawOpType draw,
                          SkTDArray<DrawType>* expected) {
@@ -552,7 +552,7 @@ static void emit_struct0(SkCanvas* canvas,
 //      matrix & clip calls (will be ignored)
 //  Restore
 // Note: the outer save/restore are provided by beginRecording/endRecording
-static void emit_struct1(SkCanvas* canvas,
+static void emit_struct1(SkCanvas* canvas, 
                          PFEmitMC emitMC, MatType mat, ClipType clip,
                          PFEmitBody emitBody, DrawOpType draw,
                          SkTDArray<DrawType>* expected) {
@@ -575,7 +575,7 @@ static void emit_struct1(SkCanvas* canvas,
 //      matrix & clip calls (will be ignored)
 //  Restore
 // Note: the outer save/restore are provided by beginRecording/endRecording
-static void emit_struct2(SkCanvas* canvas,
+static void emit_struct2(SkCanvas* canvas, 
                          PFEmitMC emitMC, MatType mat, ClipType clip,
                          PFEmitBody emitBody, DrawOpType draw,
                          SkTDArray<DrawType>* expected) {
@@ -604,7 +604,7 @@ static void emit_struct2(SkCanvas* canvas,
 //      matrix & clip calls (will be ignored)
 //  Restore
 // Note: the outer save/restore are provided by beginRecording/endRecording
-static void emit_struct3(SkCanvas* canvas,
+static void emit_struct3(SkCanvas* canvas, 
                          PFEmitMC emitMC, MatType mat, ClipType clip,
                          PFEmitBody emitBody, DrawOpType draw,
                          SkTDArray<DrawType>* expected) {
@@ -649,7 +649,7 @@ static void print(const SkTDArray<DrawType>& expected, const SkTDArray<DrawType>
 static void test_collapse(skiatest::Reporter* reporter) {
     PFEmitStruct gStructure[] = { emit_struct0, emit_struct1, emit_struct2, emit_struct3 };
     PFEmitBody gBody[] = { emit_body0, emit_body1, emit_body2, emit_body3 };
-    PFEmitMC gMCs[] = { emit_clip_and_mat, emit_mat_and_clip,
+    PFEmitMC gMCs[] = { emit_clip_and_mat, emit_mat_and_clip, 
                         emit_double_mat_and_clip, emit_mat_clip_clip };
 
     for (size_t i = 0; i < SK_ARRAY_COUNT(gStructure); ++i) {
@@ -672,12 +672,12 @@ static void test_collapse(skiatest::Reporter* reporter) {
 
                             // Note: beginRecording/endRecording add a save/restore pair
                             SkCanvas* canvas = picture.beginRecording(100, 100);
-                            (*gStructure[i])(canvas,
-                                             gMCs[k],
+                            (*gStructure[i])(canvas, 
+                                             gMCs[k], 
                                              (MatType) l,
                                              (ClipType) m,
-                                             gBody[j],
-                                             (DrawOpType) n,
+                                             gBody[j], 
+                                             (DrawOpType) n, 
                                              &expected);
                             picture.endRecording();
 
index 8075913..179a33c 100644 (file)
@@ -60,7 +60,7 @@ static void test_image(skiatest::Reporter* reporter) {
     size_t size = info.getSafeSize(rowBytes);
     void* addr = sk_malloc_throw(size);
     SkData* data = SkData::NewFromMalloc(addr, size);
-
+    
     REPORTER_ASSERT(reporter, 1 == data->getRefCnt());
     SkImage* image = SkImage::NewRasterData(info, data, rowBytes);
     REPORTER_ASSERT(reporter, 2 == data->getRefCnt());
@@ -124,7 +124,7 @@ static void test_imagepeek(skiatest::Reporter* reporter) {
     for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) {
         SkImageInfo info;
         size_t rowBytes;
-
+        
         SkAutoTUnref<SkImage> image(createImage(gRec[i].fType, NULL, color));
         if (!image.get()) {
             continue;   // gpu may not be enabled