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

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

Issue 1744103002: move annotations to canvas virtual (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « src/core/SkBitmapDevice.cpp ('k') | src/core/SkPaint.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 * 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 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after
1966 RETURN_ON_NULL(atlas); 1966 RETURN_ON_NULL(atlas);
1967 if (count <= 0) { 1967 if (count <= 0) {
1968 return; 1968 return;
1969 } 1969 }
1970 SkASSERT(atlas); 1970 SkASSERT(atlas);
1971 SkASSERT(xform); 1971 SkASSERT(xform);
1972 SkASSERT(tex); 1972 SkASSERT(tex);
1973 this->onDrawAtlas(atlas, xform, tex, colors, count, mode, cull, paint); 1973 this->onDrawAtlas(atlas, xform, tex, colors, count, mode, cull, paint);
1974 } 1974 }
1975 1975
1976 void SkCanvas::drawAnnotation(const SkRect& rect, const char key[], SkData* valu e) {
1977 if (key) {
1978 this->onDrawAnnotation(rect, key, value);
1979 }
1980 }
1981
1976 void SkCanvas::legacy_drawImageRect(const SkImage* image, const SkRect* src, con st SkRect& dst, 1982 void SkCanvas::legacy_drawImageRect(const SkImage* image, const SkRect* src, con st SkRect& dst,
1977 const SkPaint* paint, SrcRectConstraint cons traint) { 1983 const SkPaint* paint, SrcRectConstraint cons traint) {
1978 if (src) { 1984 if (src) {
1979 this->drawImageRect(image, *src, dst, paint, constraint); 1985 this->drawImageRect(image, *src, dst, paint, constraint);
1980 } else { 1986 } else {
1981 this->drawImageRect(image, SkRect::MakeIWH(image->width(), image->height ()), 1987 this->drawImageRect(image, SkRect::MakeIWH(image->width(), image->height ()),
1982 dst, paint, constraint); 1988 dst, paint, constraint);
1983 } 1989 }
1984 } 1990 }
1985 void SkCanvas::legacy_drawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst, 1991 void SkCanvas::legacy_drawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
2718 pnt = *paint; 2724 pnt = *paint;
2719 } 2725 }
2720 2726
2721 LOOPER_BEGIN(pnt, SkDrawFilter::kPath_Type, nullptr) 2727 LOOPER_BEGIN(pnt, SkDrawFilter::kPath_Type, nullptr)
2722 while (iter.next()) { 2728 while (iter.next()) {
2723 iter.fDevice->drawAtlas(iter, atlas, xform, tex, colors, count, mode, pn t); 2729 iter.fDevice->drawAtlas(iter, atlas, xform, tex, colors, count, mode, pn t);
2724 } 2730 }
2725 LOOPER_END 2731 LOOPER_END
2726 } 2732 }
2727 2733
2734 void SkCanvas::onDrawAnnotation(const SkRect& rect, const char key[], SkData* va lue) {
2735 SkASSERT(key);
2736
2737 SkPaint paint;
2738 LOOPER_BEGIN(paint, SkDrawFilter::kRect_Type, nullptr)
2739 while (iter.next()) {
2740 iter.fDevice->drawAnnotation(iter, rect, key, value);
2741 }
2742 LOOPER_END
2743 }
2744
2728 ////////////////////////////////////////////////////////////////////////////// 2745 //////////////////////////////////////////////////////////////////////////////
2729 // These methods are NOT virtual, and therefore must call back into virtual 2746 // These methods are NOT virtual, and therefore must call back into virtual
2730 // methods, rather than actually drawing themselves. 2747 // methods, rather than actually drawing themselves.
2731 ////////////////////////////////////////////////////////////////////////////// 2748 //////////////////////////////////////////////////////////////////////////////
2732 2749
2733 void SkCanvas::drawARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b, 2750 void SkCanvas::drawARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b,
2734 SkXfermode::Mode mode) { 2751 SkXfermode::Mode mode) {
2735 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawARGB()"); 2752 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawARGB()");
2736 SkPaint paint; 2753 SkPaint paint;
2737 2754
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
3001 } 3018 }
3002 3019
3003 if (matrix) { 3020 if (matrix) {
3004 canvas->concat(*matrix); 3021 canvas->concat(*matrix);
3005 } 3022 }
3006 } 3023 }
3007 3024
3008 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 3025 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
3009 fCanvas->restoreToCount(fSaveCount); 3026 fCanvas->restoreToCount(fSaveCount);
3010 } 3027 }
OLDNEW
« no previous file with comments | « src/core/SkBitmapDevice.cpp ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698