Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Side by Side Diff: src/pipe/utils/SamplePipeControllers.h

Issue 14230022: Fixes for piping bitmaps with encoded data. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Add some asserts and comments. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/pipe/SkGPipeWrite.cpp ('k') | src/pipe/utils/SamplePipeControllers.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkChunkAlloc.h" 9 #include "SkChunkAlloc.h"
10 #include "SkGPipe.h" 10 #include "SkGPipe.h"
11 #include "SkPicture.h"
11 #include "SkTDArray.h" 12 #include "SkTDArray.h"
12 13
13 class SkCanvas; 14 class SkCanvas;
14 class SkMatrix; 15 class SkMatrix;
15 16
16 class PipeController : public SkGPipeController { 17 class PipeController : public SkGPipeController {
17 public: 18 public:
18 PipeController(SkCanvas* target); 19 PipeController(SkCanvas* target, SkPicture::InstallPixelRefProc proc = NULL) ;
19 virtual ~PipeController(); 20 virtual ~PipeController();
20 virtual void* requestBlock(size_t minRequest, size_t* actual) SK_OVERRIDE; 21 virtual void* requestBlock(size_t minRequest, size_t* actual) SK_OVERRIDE;
21 virtual void notifyWritten(size_t bytes) SK_OVERRIDE; 22 virtual void notifyWritten(size_t bytes) SK_OVERRIDE;
22 protected: 23 protected:
23 const void* getData() { return (const char*) fBlock + fBytesWritten; } 24 const void* getData() { return (const char*) fBlock + fBytesWritten; }
24 SkGPipeReader fReader; 25 SkGPipeReader fReader;
25 private: 26 private:
26 void* fBlock; 27 void* fBlock;
27 size_t fBlockSize; 28 size_t fBlockSize;
28 size_t fBytesWritten; 29 size_t fBytesWritten;
29 SkGPipeReader::Status fStatus; 30 SkGPipeReader::Status fStatus;
30 }; 31 };
31 32
32 //////////////////////////////////////////////////////////////////////////////// 33 ////////////////////////////////////////////////////////////////////////////////
33 34
34 class TiledPipeController : public PipeController { 35 class TiledPipeController : public PipeController {
35 public: 36 public:
36 TiledPipeController(const SkBitmap&, const SkMatrix* initialMatrix = NULL); 37 TiledPipeController(const SkBitmap&, SkPicture::InstallPixelRefProc proc = N ULL,
38 const SkMatrix* initialMatrix = NULL);
37 virtual ~TiledPipeController() {}; 39 virtual ~TiledPipeController() {};
38 virtual void notifyWritten(size_t bytes) SK_OVERRIDE; 40 virtual void notifyWritten(size_t bytes) SK_OVERRIDE;
39 virtual int numberOfReaders() const SK_OVERRIDE { return NumberOfTiles; } 41 virtual int numberOfReaders() const SK_OVERRIDE { return NumberOfTiles; }
40 private: 42 private:
41 enum { 43 enum {
42 NumberOfTiles = 10 44 NumberOfTiles = 10
43 }; 45 };
44 SkGPipeReader fReaders[NumberOfTiles - 1]; 46 SkGPipeReader fReaders[NumberOfTiles - 1];
45 SkBitmap fBitmaps[NumberOfTiles]; 47 SkBitmap fBitmaps[NumberOfTiles];
46 typedef PipeController INHERITED; 48 typedef PipeController INHERITED;
(...skipping 29 matching lines...) Expand all
76 void* fBlock; 78 void* fBlock;
77 // Number of bytes that were written to fBlock. 79 // Number of bytes that were written to fBlock.
78 size_t fBytes; 80 size_t fBytes;
79 }; 81 };
80 void* fBlock; 82 void* fBlock;
81 size_t fBytesWritten; 83 size_t fBytesWritten;
82 SkChunkAlloc fAllocator; 84 SkChunkAlloc fAllocator;
83 SkTDArray<PipeBlock> fBlockList; 85 SkTDArray<PipeBlock> fBlockList;
84 int fNumberOfReaders; 86 int fNumberOfReaders;
85 }; 87 };
OLDNEW
« no previous file with comments | « src/pipe/SkGPipeWrite.cpp ('k') | src/pipe/utils/SamplePipeControllers.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698