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

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

Issue 2146073003: Creating framework for drawShadowedPicture (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Missed error Created 4 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
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 "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCanvasPriv.h" 10 #include "SkCanvasPriv.h"
(...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 void SkCanvas::translateZ(SkScalar z) { 1547 void SkCanvas::translateZ(SkScalar z) {
1548 this->checkForDeferredSave(); 1548 this->checkForDeferredSave();
1549 this->fMCRec->fCurDrawDepth += z; 1549 this->fMCRec->fCurDrawDepth += z;
1550 this->didTranslateZ(z); 1550 this->didTranslateZ(z);
1551 } 1551 }
1552 1552
1553 SkScalar SkCanvas::getZ() const { 1553 SkScalar SkCanvas::getZ() const {
1554 return this->fMCRec->fCurDrawDepth; 1554 return this->fMCRec->fCurDrawDepth;
1555 } 1555 }
1556 1556
1557 #ifndef SK_RELEASE
1558 void SkCanvas::setLights(sk_sp<SkLights> lights) {
1559 this->fLights = lights;
1560 }
1561
1562 sk_sp<SkLights> SkCanvas::getLights() const {
1563 return this->fLights;
1564 }
1565 #endif
1566
1557 ////////////////////////////////////////////////////////////////////////////// 1567 //////////////////////////////////////////////////////////////////////////////
1558 1568
1559 void SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { 1569 void SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
1560 if (!fAllowSoftClip) { 1570 if (!fAllowSoftClip) {
1561 doAA = false; 1571 doAA = false;
1562 } 1572 }
1563 1573
1564 #ifdef SK_SUPPORT_PRECHECK_CLIPRECT 1574 #ifdef SK_SUPPORT_PRECHECK_CLIPRECT
1565 // Check if we can quick-accept the clip call (and do nothing) 1575 // Check if we can quick-accept the clip call (and do nothing)
1566 // 1576 //
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after
3024 } 3034 }
3025 if (this->quickReject(bounds)) { 3035 if (this->quickReject(bounds)) {
3026 return; 3036 return;
3027 } 3037 }
3028 } 3038 }
3029 3039
3030 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect()); 3040 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect());
3031 picture->playback(this); 3041 picture->playback(this);
3032 } 3042 }
3033 3043
3044 #ifndef SK_RELEASE
3045 void SkCanvas::drawShadowedPicture(const SkPicture* picture,
3046 const SkMatrix* matrix,
3047 const SkPaint* paint) {
3048 RETURN_ON_NULL(picture);
3049
3050 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawShadowedPicture()");
3051
3052 this->onDrawShadowedPicture(picture, matrix, paint);
3053 }
3054
3055 void SkCanvas::onDrawShadowedPicture(const SkPicture* picture,
3056 const SkMatrix* matrix,
3057 const SkPaint* paint) {
3058 this->onDrawPicture(picture, matrix, paint);
3059 }
3060 #endif
3061
3034 /////////////////////////////////////////////////////////////////////////////// 3062 ///////////////////////////////////////////////////////////////////////////////
3035 /////////////////////////////////////////////////////////////////////////////// 3063 ///////////////////////////////////////////////////////////////////////////////
3036 3064
3037 SkCanvas::LayerIter::LayerIter(SkCanvas* canvas, bool skipEmptyClips) { 3065 SkCanvas::LayerIter::LayerIter(SkCanvas* canvas, bool skipEmptyClips) {
3038 static_assert(sizeof(fStorage) >= sizeof(SkDrawIter), "fStorage_too_small"); 3066 static_assert(sizeof(fStorage) >= sizeof(SkDrawIter), "fStorage_too_small");
3039 3067
3040 SkASSERT(canvas); 3068 SkASSERT(canvas);
3041 3069
3042 fImpl = new (fStorage) SkDrawIter(canvas, skipEmptyClips); 3070 fImpl = new (fStorage) SkDrawIter(canvas, skipEmptyClips);
3043 fDone = !fImpl->next(); 3071 fDone = !fImpl->next();
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
3134 3162
3135 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 3163 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
3136 fCanvas->restoreToCount(fSaveCount); 3164 fCanvas->restoreToCount(fSaveCount);
3137 } 3165 }
3138 3166
3139 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API 3167 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API
3140 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) { 3168 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) {
3141 return this->makeSurface(info, props).release(); 3169 return this->makeSurface(info, props).release();
3142 } 3170 }
3143 #endif 3171 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698