aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-30 02:32:41 +0000
committerGravatar scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-30 02:32:41 +0000
commit74b7ffda687c66d46ac3cfa4f2baedd4c62e3fbe (patch)
tree32a50dd0204aabd8ba2264f396f462c8dd05182c /include
parentaf5c506cd6b63f43a0ebee2fb171ea55ba98e09f (diff)
Fixes for piping bitmaps with encoded data.
Similar goals as https://codereview.chromium.org/14437012. Builds on patch set 1 from that issue (https://codereview.chromium.org/14437012/#ps1). Instead of the changes in patch set 2 from that issue, this changes SkOrderedWriteBuffer::writeBitmap to store whether an SkBitmapHeap was used when to store the index of the SkBitmap. SkOrderedReadBuffer::readBitmap now uses that information to distinguish between using the heap and unflattening. In addition, writeBitmap now records the width/height first in all cases. If now SkBitmapHeapReader is attached, but an SkBitmapHeap was used to record the bitmap, reading will fail and provide the same red SkBitmap as in the case where the SkBitmap was encoded but could not be decoded. Updates the PICTURE_VERSION as well. The key differences in this CL to look at are in: SkOrderedWriteBuffer, SkOrderedReadBuffer, and SkPicture. BUG= R=djsollen@google.com Review URL: https://codereview.chromium.org/14230022 git-svn-id: http://skia.googlecode.com/svn/trunk@8917 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkPicture.h3
-rw-r--r--include/pipe/SkGPipe.h15
2 files changed, 13 insertions, 5 deletions
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index be682b115d..b2c2b62ede 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -203,7 +203,8 @@ protected:
// V9 : Allow the reader and writer of an SKP disagree on whether to support
// SK_SUPPORT_HINTING_SCALE_FACTOR
// V10: add drawRRect, drawOval, clipRRect
- static const uint32_t PICTURE_VERSION = 10;
+ // V11: modify how readBitmap and writeBitmap store their info.
+ static const uint32_t PICTURE_VERSION = 11;
// fPlayback, fRecord, fWidth & fHeight are protected to allow derived classes to
// install their own SkPicturePlayback-derived players,SkPictureRecord-derived
diff --git a/include/pipe/SkGPipe.h b/include/pipe/SkGPipe.h
index 27af16db8c..879ab043ff 100644
--- a/include/pipe/SkGPipe.h
+++ b/include/pipe/SkGPipe.h
@@ -1,4 +1,3 @@
-
/*
* Copyright 2011 Google Inc.
*
@@ -11,8 +10,9 @@
#ifndef SkGPipe_DEFINED
#define SkGPipe_DEFINED
-#include "SkWriter32.h"
#include "SkFlattenable.h"
+#include "SkPicture.h"
+#include "SkWriter32.h"
class SkCanvas;
@@ -40,13 +40,20 @@ public:
};
void setCanvas(SkCanvas*);
+
+ /**
+ * Set a function for decoding bitmaps that have encoded data.
+ */
+ void setBitmapDecoder(SkPicture::InstallPixelRefProc proc) { fProc = proc; }
+
// data must be 4-byte aligned
// length must be a multiple of 4
Status playback(const void* data, size_t length, uint32_t playbackFlags = 0,
size_t* bytesRead = NULL);
private:
- SkCanvas* fCanvas;
- class SkGPipeState* fState;
+ SkCanvas* fCanvas;
+ class SkGPipeState* fState;
+ SkPicture::InstallPixelRefProc fProc;
};
///////////////////////////////////////////////////////////////////////////////