 Chromium Code Reviews
 Chromium Code Reviews Issue 169023002:
  still trying to kill setDevice: rename to setRootDevice (better name) and make private  (Closed) 
  Base URL: https://skia.googlecode.com/svn/trunk
    
  
    Issue 169023002:
  still trying to kill setDevice: rename to setRootDevice (better name) and make private  (Closed) 
  Base URL: https://skia.googlecode.com/svn/trunk| OLD | NEW | 
|---|---|
| 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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 418 | 418 | 
| 419 /////////////////////////////////////////////////////////////////////////////// | 419 /////////////////////////////////////////////////////////////////////////////// | 
| 420 | 420 | 
| 421 #define MIN_BLOCK_SIZE (16 * 1024) | 421 #define MIN_BLOCK_SIZE (16 * 1024) | 
| 422 #define BITMAPS_TO_KEEP 5 | 422 #define BITMAPS_TO_KEEP 5 | 
| 423 #define FLATTENABLES_TO_KEEP 10 | 423 #define FLATTENABLES_TO_KEEP 10 | 
| 424 | 424 | 
| 425 SkGPipeCanvas::SkGPipeCanvas(SkGPipeController* controller, | 425 SkGPipeCanvas::SkGPipeCanvas(SkGPipeController* controller, | 
| 426 SkWriter32* writer, uint32_t flags, | 426 SkWriter32* writer, uint32_t flags, | 
| 427 uint32_t width, uint32_t height) | 427 uint32_t width, uint32_t height) | 
| 428 : fFactorySet(isCrossProcess(flags) ? SkNEW(SkNamedFactorySet) : NULL) | 428 : SkCanvas(width, height) | 
| 
scroggo
2014/02/17 14:40:43
nit: INHERITED.
 | |
| 429 , fWriter(*writer) | 429 , fFactorySet(isCrossProcess(flags) ? SkNEW(SkNamedFactorySet) : NULL) | 
| 430 , fFlags(flags) | 430 , fWriter(*writer) | 
| 431 , fFlattenableHeap(FLATTENABLES_TO_KEEP, fFactorySet, isCrossProcess(flags)) | 431 , fFlags(flags) | 
| 432 , fFlatDictionary(&fFlattenableHeap) { | 432 , fFlattenableHeap(FLATTENABLES_TO_KEEP, fFactorySet, isCrossProcess(flags)) | 
| 433 , fFlatDictionary(&fFlattenableHeap) | |
| 434 { | |
| 433 fController = controller; | 435 fController = controller; | 
| 434 fDone = false; | 436 fDone = false; | 
| 435 fBlockSize = 0; // need first block from controller | 437 fBlockSize = 0; // need first block from controller | 
| 436 fBytesNotified = 0; | 438 fBytesNotified = 0; | 
| 437 fFirstSaveLayerStackLevel = kNoSaveLayer; | 439 fFirstSaveLayerStackLevel = kNoSaveLayer; | 
| 438 sk_bzero(fCurrFlatIndex, sizeof(fCurrFlatIndex)); | 440 sk_bzero(fCurrFlatIndex, sizeof(fCurrFlatIndex)); | 
| 439 | 441 | 
| 440 // we need a device to limit our clip | |
| 441 // We don't allocate pixels for the bitmap | |
| 442 SkBitmap bitmap; | |
| 443 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); | |
| 444 SkBaseDevice* device = SkNEW_ARGS(SkBitmapDevice, (bitmap)); | |
| 445 this->setDevice(device)->unref(); | |
| 446 | |
| 447 // Tell the reader the appropriate flags to use. | 442 // Tell the reader the appropriate flags to use. | 
| 448 if (this->needOpBytes()) { | 443 if (this->needOpBytes()) { | 
| 449 this->writeOp(kReportFlags_DrawOp, fFlags, 0); | 444 this->writeOp(kReportFlags_DrawOp, fFlags, 0); | 
| 450 } | 445 } | 
| 451 | 446 | 
| 452 if (shouldFlattenBitmaps(flags)) { | 447 if (shouldFlattenBitmaps(flags)) { | 
| 453 fBitmapShuttle.reset(SkNEW_ARGS(BitmapShuttle, (this))); | 448 fBitmapShuttle.reset(SkNEW_ARGS(BitmapShuttle, (this))); | 
| 454 fBitmapHeap = SkNEW_ARGS(SkBitmapHeap, (fBitmapShuttle.get(), BITMAPS_TO _KEEP)); | 449 fBitmapHeap = SkNEW_ARGS(SkBitmapHeap, (fBitmapShuttle.get(), BITMAPS_TO _KEEP)); | 
| 455 } else { | 450 } else { | 
| 456 fBitmapHeap = SkNEW_ARGS(SkBitmapHeap, | 451 fBitmapHeap = SkNEW_ARGS(SkBitmapHeap, | 
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1235 return fCanvas->shuttleBitmap(bitmap, slot); | 1230 return fCanvas->shuttleBitmap(bitmap, slot); | 
| 1236 } | 1231 } | 
| 1237 | 1232 | 
| 1238 void BitmapShuttle::removeCanvas() { | 1233 void BitmapShuttle::removeCanvas() { | 
| 1239 if (NULL == fCanvas) { | 1234 if (NULL == fCanvas) { | 
| 1240 return; | 1235 return; | 
| 1241 } | 1236 } | 
| 1242 fCanvas->unref(); | 1237 fCanvas->unref(); | 
| 1243 fCanvas = NULL; | 1238 fCanvas = NULL; | 
| 1244 } | 1239 } | 
| OLD | NEW |