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

Side by Side Diff: src/pipe/SkGPipeWrite.cpp

Issue 26606004: change SkAnnotation to not inherit from SkFlattenable (does not need dynamic factories) (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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/SkGPipeRead.cpp ('k') | src/ports/SkGlobalInitialization_default.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkAnnotation.h" 9 #include "SkAnnotation.h"
10 #include "SkBitmapDevice.h" 10 #include "SkBitmapDevice.h"
(...skipping 30 matching lines...) Expand all
41 SkASSERT(paintFlat < kCount_PaintFlats); 41 SkASSERT(paintFlat < kCount_PaintFlats);
42 switch (paintFlat) { 42 switch (paintFlat) {
43 case kColorFilter_PaintFlat: return paint.getColorFilter(); 43 case kColorFilter_PaintFlat: return paint.getColorFilter();
44 case kDrawLooper_PaintFlat: return paint.getLooper(); 44 case kDrawLooper_PaintFlat: return paint.getLooper();
45 case kMaskFilter_PaintFlat: return paint.getMaskFilter(); 45 case kMaskFilter_PaintFlat: return paint.getMaskFilter();
46 case kPathEffect_PaintFlat: return paint.getPathEffect(); 46 case kPathEffect_PaintFlat: return paint.getPathEffect();
47 case kRasterizer_PaintFlat: return paint.getRasterizer(); 47 case kRasterizer_PaintFlat: return paint.getRasterizer();
48 case kShader_PaintFlat: return paint.getShader(); 48 case kShader_PaintFlat: return paint.getShader();
49 case kImageFilter_PaintFlat: return paint.getImageFilter(); 49 case kImageFilter_PaintFlat: return paint.getImageFilter();
50 case kXfermode_PaintFlat: return paint.getXfermode(); 50 case kXfermode_PaintFlat: return paint.getXfermode();
51 case kAnnotation_PaintFlat: return paint.getAnnotation();
52 } 51 }
53 SkDEBUGFAIL("never gets here"); 52 SkDEBUGFAIL("never gets here");
54 return NULL; 53 return NULL;
55 } 54 }
56 55
57 static size_t writeTypeface(SkWriter32* writer, SkTypeface* typeface) { 56 static size_t writeTypeface(SkWriter32* writer, SkTypeface* typeface) {
58 SkASSERT(typeface); 57 SkASSERT(typeface);
59 SkDynamicMemoryWStream stream; 58 SkDynamicMemoryWStream stream;
60 typeface->serialize(&stream); 59 typeface->serialize(&stream);
61 size_t size = stream.getOffset(); 60 size_t size = stream.getOffset();
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 } 1115 }
1117 1116
1118 size_t size = (char*)ptr - (char*)storage; 1117 size_t size = (char*)ptr - (char*)storage;
1119 if (size && this->needOpBytes(size)) { 1118 if (size && this->needOpBytes(size)) {
1120 this->writeOp(kPaintOp_DrawOp, 0, size); 1119 this->writeOp(kPaintOp_DrawOp, 0, size);
1121 fWriter.write(storage, size); 1120 fWriter.write(storage, size);
1122 for (size_t i = 0; i < size/4; i++) { 1121 for (size_t i = 0; i < size/4; i++) {
1123 // SkDebugf("[%d] %08X\n", i, storage[i]); 1122 // SkDebugf("[%d] %08X\n", i, storage[i]);
1124 } 1123 }
1125 } 1124 }
1125
1126 //
1127 // Do these after we've written kPaintOp_DrawOp
1128
1129 if (base.getAnnotation() != paint.getAnnotation()) {
1130 if (NULL == paint.getAnnotation()) {
1131 this->writeOp(kSetAnnotation_DrawOp, 0, 0);
1132 } else {
1133 SkOrderedWriteBuffer buffer(1024);
1134 paint.getAnnotation()->writeToBuffer(buffer);
1135 size = buffer.bytesWritten();
1136
1137 SkAutoMalloc storage(size);
1138 buffer.writeToMemory(storage.get());
1139
1140 this->writeOp(kSetAnnotation_DrawOp, 0, 1);
1141 fWriter.write32(size);
1142 fWriter.write(storage.get(), size);
1143 }
1144 }
1126 } 1145 }
1127 1146
1128 /////////////////////////////////////////////////////////////////////////////// 1147 ///////////////////////////////////////////////////////////////////////////////
1129 1148
1130 #include "SkGPipe.h" 1149 #include "SkGPipe.h"
1131 1150
1132 SkGPipeController::~SkGPipeController() { 1151 SkGPipeController::~SkGPipeController() {
1133 SkSafeUnref(fCanvas); 1152 SkSafeUnref(fCanvas);
1134 } 1153 }
1135 1154
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 fCanvas->ref(); 1210 fCanvas->ref();
1192 } 1211 }
1193 1212
1194 BitmapShuttle::~BitmapShuttle() { 1213 BitmapShuttle::~BitmapShuttle() {
1195 fCanvas->unref(); 1214 fCanvas->unref();
1196 } 1215 }
1197 1216
1198 bool BitmapShuttle::insert(const SkBitmap& bitmap, int32_t slot) { 1217 bool BitmapShuttle::insert(const SkBitmap& bitmap, int32_t slot) {
1199 return fCanvas->shuttleBitmap(bitmap, slot); 1218 return fCanvas->shuttleBitmap(bitmap, slot);
1200 } 1219 }
OLDNEW
« no previous file with comments | « src/pipe/SkGPipeRead.cpp ('k') | src/ports/SkGlobalInitialization_default.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698