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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 } | 225 } |
226 | 226 |
227 void flushRecording(bool detachCurrentBlock); | 227 void flushRecording(bool detachCurrentBlock); |
228 size_t freeMemoryIfPossible(size_t bytesToFree); | 228 size_t freeMemoryIfPossible(size_t bytesToFree); |
229 | 229 |
230 size_t storageAllocatedForRecording() { | 230 size_t storageAllocatedForRecording() { |
231 return (NULL == fBitmapHeap) ? 0 : fBitmapHeap->bytesAllocated(); | 231 return (NULL == fBitmapHeap) ? 0 : fBitmapHeap->bytesAllocated(); |
232 } | 232 } |
233 | 233 |
234 // overrides from SkCanvas | 234 // overrides from SkCanvas |
235 virtual bool isDrawingToLayer() const SK_OVERRIDE; | |
236 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE; | 235 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE; |
237 virtual void drawPoints(PointMode, size_t count, const SkPoint pts[], | 236 virtual void drawPoints(PointMode, size_t count, const SkPoint pts[], |
238 const SkPaint&) SK_OVERRIDE; | 237 const SkPaint&) SK_OVERRIDE; |
239 virtual void drawOval(const SkRect&, const SkPaint&) SK_OVERRIDE; | 238 virtual void drawOval(const SkRect&, const SkPaint&) SK_OVERRIDE; |
240 virtual void drawRect(const SkRect& rect, const SkPaint&) SK_OVERRIDE; | 239 virtual void drawRect(const SkRect& rect, const SkPaint&) SK_OVERRIDE; |
241 virtual void drawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE; | 240 virtual void drawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE; |
242 virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE; | 241 virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE; |
243 virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top, | 242 virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top, |
244 const SkPaint*) SK_OVERRIDE; | 243 const SkPaint*) SK_OVERRIDE; |
245 virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src, | 244 virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src, |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
571 this->writeOp(kRestore_DrawOp); | 570 this->writeOp(kRestore_DrawOp); |
572 } | 571 } |
573 | 572 |
574 if (this->getSaveCount() - 1 == fFirstSaveLayerStackLevel){ | 573 if (this->getSaveCount() - 1 == fFirstSaveLayerStackLevel){ |
575 fFirstSaveLayerStackLevel = kNoSaveLayer; | 574 fFirstSaveLayerStackLevel = kNoSaveLayer; |
576 } | 575 } |
577 | 576 |
578 this->INHERITED::willRestore(); | 577 this->INHERITED::willRestore(); |
579 } | 578 } |
580 | 579 |
581 bool SkGPipeCanvas::isDrawingToLayer() const { | |
582 return kNoSaveLayer != fFirstSaveLayerStackLevel; | |
mtklein
2014/12/15 17:33:34
Also clean up fFirstSaveLayerStackLevel / kNoSaveL
| |
583 } | |
584 | |
585 void SkGPipeCanvas::recordTranslate(const SkMatrix& m) { | 580 void SkGPipeCanvas::recordTranslate(const SkMatrix& m) { |
586 if (this->needOpBytes(2 * sizeof(SkScalar))) { | 581 if (this->needOpBytes(2 * sizeof(SkScalar))) { |
587 this->writeOp(kTranslate_DrawOp); | 582 this->writeOp(kTranslate_DrawOp); |
588 fWriter.writeScalar(m.getTranslateX()); | 583 fWriter.writeScalar(m.getTranslateX()); |
589 fWriter.writeScalar(m.getTranslateY()); | 584 fWriter.writeScalar(m.getTranslateY()); |
590 } | 585 } |
591 } | 586 } |
592 | 587 |
593 void SkGPipeCanvas::recordScale(const SkMatrix& m) { | 588 void SkGPipeCanvas::recordScale(const SkMatrix& m) { |
594 if (this->needOpBytes(2 * sizeof(SkScalar))) { | 589 if (this->needOpBytes(2 * sizeof(SkScalar))) { |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1367 return fCanvas->shuttleBitmap(bitmap, slot); | 1362 return fCanvas->shuttleBitmap(bitmap, slot); |
1368 } | 1363 } |
1369 | 1364 |
1370 void BitmapShuttle::removeCanvas() { | 1365 void BitmapShuttle::removeCanvas() { |
1371 if (NULL == fCanvas) { | 1366 if (NULL == fCanvas) { |
1372 return; | 1367 return; |
1373 } | 1368 } |
1374 fCanvas->unref(); | 1369 fCanvas->unref(); |
1375 fCanvas = NULL; | 1370 fCanvas = NULL; |
1376 } | 1371 } |
OLD | NEW |