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

Side by Side Diff: src/core/SkPictureRecord.cpp

Issue 154163002: remove SkCanvas::createCompatibleDevice, and add SkCanvas::newSurface (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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
OLDNEW
1
2 /* 1 /*
3 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
4 * 3 *
5 * 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
6 * found in the LICENSE file. 5 * found in the LICENSE file.
7 */ 6 */
7
8 #include "SkPictureRecord.h" 8 #include "SkPictureRecord.h"
9 #include "SkTSearch.h" 9 #include "SkTSearch.h"
10 #include "SkPixelRef.h" 10 #include "SkPixelRef.h"
11 #include "SkRRect.h" 11 #include "SkRRect.h"
12 #include "SkBBoxHierarchy.h" 12 #include "SkBBoxHierarchy.h"
13 #include "SkDevice.h" 13 #include "SkDevice.h"
14 #include "SkPictureStateTree.h" 14 #include "SkPictureStateTree.h"
15 #include "SkSurface.h"
15 16
16 #define HEAP_BLOCK_SIZE 4096 17 #define HEAP_BLOCK_SIZE 4096
17 18
18 enum { 19 enum {
19 // just need a value that save or getSaveCount would never return 20 // just need a value that save or getSaveCount would never return
20 kNoInitialSave = -1, 21 kNoInitialSave = -1,
21 }; 22 };
22 23
23 // A lot of basic types get stored as a uint32_t: bools, ints, paint indices, et c. 24 // A lot of basic types get stored as a uint32_t: bools, ints, paint indices, et c.
24 static int const kUInt32Size = 4; 25 static int const kUInt32Size = 4;
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 1273
1273 void SkPictureRecord::endCommentGroup() { 1274 void SkPictureRecord::endCommentGroup() {
1274 // op/size 1275 // op/size
1275 uint32_t size = 1 * kUInt32Size; 1276 uint32_t size = 1 * kUInt32Size;
1276 size_t initialOffset = this->addDraw(END_COMMENT_GROUP, &size); 1277 size_t initialOffset = this->addDraw(END_COMMENT_GROUP, &size);
1277 this->validate(initialOffset, size); 1278 this->validate(initialOffset, size);
1278 } 1279 }
1279 1280
1280 /////////////////////////////////////////////////////////////////////////////// 1281 ///////////////////////////////////////////////////////////////////////////////
1281 1282
1283 SkSurface* SkPictureRecord::onNewSurface(const SkImageInfo& info) {
1284 return SkSurface::NewPicture(info.fWidth, info.fHeight);
1285 }
1286
1282 void SkPictureRecord::addBitmap(const SkBitmap& bitmap) { 1287 void SkPictureRecord::addBitmap(const SkBitmap& bitmap) {
1283 const int index = fBitmapHeap->insert(bitmap); 1288 const int index = fBitmapHeap->insert(bitmap);
1284 // In debug builds, a bad return value from insert() will crash, allowing fo r debugging. In 1289 // In debug builds, a bad return value from insert() will crash, allowing fo r debugging. In
1285 // release builds, the invalid value will be recorded so that the reader wil l know that there 1290 // release builds, the invalid value will be recorded so that the reader wil l know that there
1286 // was a problem. 1291 // was a problem.
1287 SkASSERT(index != SkBitmapHeap::INVALID_SLOT); 1292 SkASSERT(index != SkBitmapHeap::INVALID_SLOT);
1288 addInt(index); 1293 addInt(index);
1289 } 1294 }
1290 1295
1291 void SkPictureRecord::addMatrix(const SkMatrix& matrix) { 1296 void SkPictureRecord::addMatrix(const SkMatrix& matrix) {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 void SkPictureRecord::validateRegions() const { 1522 void SkPictureRecord::validateRegions() const {
1518 int count = fRegions.count(); 1523 int count = fRegions.count();
1519 SkASSERT((unsigned) count < 0x1000); 1524 SkASSERT((unsigned) count < 0x1000);
1520 for (int index = 0; index < count; index++) { 1525 for (int index = 0; index < count; index++) {
1521 const SkFlatData* region = fRegions[index]; 1526 const SkFlatData* region = fRegions[index];
1522 SkASSERT(region); 1527 SkASSERT(region);
1523 // region->validate(); 1528 // region->validate();
1524 } 1529 }
1525 } 1530 }
1526 #endif 1531 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698