aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pipe/utils
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 /src/pipe/utils
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 'src/pipe/utils')
-rw-r--r--src/pipe/utils/SamplePipeControllers.cpp7
-rw-r--r--src/pipe/utils/SamplePipeControllers.h6
2 files changed, 9 insertions, 4 deletions
diff --git a/src/pipe/utils/SamplePipeControllers.cpp b/src/pipe/utils/SamplePipeControllers.cpp
index 10e4ea0f0a..a23d77537c 100644
--- a/src/pipe/utils/SamplePipeControllers.cpp
+++ b/src/pipe/utils/SamplePipeControllers.cpp
@@ -12,10 +12,11 @@
#include "SkGPipe.h"
#include "SkMatrix.h"
-PipeController::PipeController(SkCanvas* target)
+PipeController::PipeController(SkCanvas* target, SkPicture::InstallPixelRefProc proc)
:fReader(target) {
fBlock = NULL;
fBlockSize = fBytesWritten = 0;
+ fReader.setBitmapDecoder(proc);
}
PipeController::~PipeController() {
@@ -40,8 +41,9 @@ void PipeController::notifyWritten(size_t bytes) {
////////////////////////////////////////////////////////////////////////////////
TiledPipeController::TiledPipeController(const SkBitmap& bitmap,
+ SkPicture::InstallPixelRefProc proc,
const SkMatrix* initial)
-: INHERITED(NULL) {
+: INHERITED(NULL, proc) {
int32_t top = 0;
int32_t bottom;
int32_t height = bitmap.height() / NumberOfTiles;
@@ -65,6 +67,7 @@ TiledPipeController::TiledPipeController(const SkBitmap& bitmap,
fReader.setCanvas(canvas);
} else {
fReaders[i - 1].setCanvas(canvas);
+ fReaders[i - 1].setBitmapDecoder(proc);
}
canvas->unref();
}
diff --git a/src/pipe/utils/SamplePipeControllers.h b/src/pipe/utils/SamplePipeControllers.h
index 5efd6f0b9f..35cfba73b6 100644
--- a/src/pipe/utils/SamplePipeControllers.h
+++ b/src/pipe/utils/SamplePipeControllers.h
@@ -8,6 +8,7 @@
#include "SkBitmap.h"
#include "SkChunkAlloc.h"
#include "SkGPipe.h"
+#include "SkPicture.h"
#include "SkTDArray.h"
class SkCanvas;
@@ -15,7 +16,7 @@ class SkMatrix;
class PipeController : public SkGPipeController {
public:
- PipeController(SkCanvas* target);
+ PipeController(SkCanvas* target, SkPicture::InstallPixelRefProc proc = NULL);
virtual ~PipeController();
virtual void* requestBlock(size_t minRequest, size_t* actual) SK_OVERRIDE;
virtual void notifyWritten(size_t bytes) SK_OVERRIDE;
@@ -33,7 +34,8 @@ private:
class TiledPipeController : public PipeController {
public:
- TiledPipeController(const SkBitmap&, const SkMatrix* initialMatrix = NULL);
+ TiledPipeController(const SkBitmap&, SkPicture::InstallPixelRefProc proc = NULL,
+ const SkMatrix* initialMatrix = NULL);
virtual ~TiledPipeController() {};
virtual void notifyWritten(size_t bytes) SK_OVERRIDE;
virtual int numberOfReaders() const SK_OVERRIDE { return NumberOfTiles; }