From 74b7ffda687c66d46ac3cfa4f2baedd4c62e3fbe Mon Sep 17 00:00:00 2001 From: "scroggo@google.com" Date: Tue, 30 Apr 2013 02:32:41 +0000 Subject: 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 --- samplecode/SampleApp.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'samplecode') diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index badc7c01e8..10106323e2 100644 --- a/samplecode/SampleApp.cpp +++ b/samplecode/SampleApp.cpp @@ -10,6 +10,7 @@ #include "SkCanvas.h" #include "SkDevice.h" #include "SkGraphics.h" +#include "SkImageDecoder.h" #include "SkImageEncoder.h" #include "SkPaint.h" #include "SkPicture.h" @@ -2203,6 +2204,7 @@ SimplePC::SimplePC(SkCanvas* target) : fReader(target) { fStatus = SkGPipeReader::kDone_Status; fTotalWritten = 0; fAtomsWritten = 0; + fReader.setBitmapDecoder(&SkImageDecoder::DecodeMemory); } SimplePC::~SimplePC() { @@ -2254,6 +2256,7 @@ void SampleView::draw(SkCanvas* canvas) { SkGPipeWriter writer; SimplePC controller(canvas); TiledPipeController tc(canvas->getDevice()->accessBitmap(false), + &SkImageDecoder::DecodeMemory, &canvas->getTotalMatrix()); SkGPipeController* pc; if (SkOSMenu::kMixedState == fPipeState) { -- cgit v1.2.3