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

Side by Side Diff: include/core/SkCanvas.h

Issue 583453002: SkCanvas::drawImage is the new way for drawing an SkImage to a Canvas (Closed) Base URL: https://skia.googlesource.com/skia.git@refactor_skImage
Patch Set: Again Created 6 years, 2 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 2006 The Android Open Source Project 2 * Copyright 2006 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 #ifndef SkCanvas_DEFINED 8 #ifndef SkCanvas_DEFINED
9 #define SkCanvas_DEFINED 9 #define SkCanvas_DEFINED
10 10
(...skipping 11 matching lines...) Expand all
22 #ifdef SK_SUPPORT_LEGACY_DRAWTEXT_VIRTUAL 22 #ifdef SK_SUPPORT_LEGACY_DRAWTEXT_VIRTUAL
23 #define SK_LEGACY_DRAWTEXT_VIRTUAL virtual 23 #define SK_LEGACY_DRAWTEXT_VIRTUAL virtual
24 #else 24 #else
25 #define SK_LEGACY_DRAWTEXT_VIRTUAL 25 #define SK_LEGACY_DRAWTEXT_VIRTUAL
26 #endif 26 #endif
27 27
28 class SkCanvasClipVisitor; 28 class SkCanvasClipVisitor;
29 class SkBaseDevice; 29 class SkBaseDevice;
30 class SkDraw; 30 class SkDraw;
31 class SkDrawFilter; 31 class SkDrawFilter;
32 class SkImage;
32 class SkMetaData; 33 class SkMetaData;
33 class SkPicture; 34 class SkPicture;
34 class SkRRect; 35 class SkRRect;
35 class SkSurface; 36 class SkSurface;
36 class SkSurface_Base; 37 class SkSurface_Base;
37 class SkTextBlob; 38 class SkTextBlob;
38 class GrContext; 39 class GrContext;
39 class GrRenderTarget; 40 class GrRenderTarget;
40 41
41 class SkCanvasState; 42 class SkCanvasState;
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 void drawRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry, 805 void drawRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry,
805 const SkPaint& paint); 806 const SkPaint& paint);
806 807
807 /** Draw the specified path using the specified paint. The path will be 808 /** Draw the specified path using the specified paint. The path will be
808 filled or framed based on the Style in the paint. 809 filled or framed based on the Style in the paint.
809 @param path The path to be drawn 810 @param path The path to be drawn
810 @param paint The paint used to draw the path 811 @param paint The paint used to draw the path
811 */ 812 */
812 virtual void drawPath(const SkPath& path, const SkPaint& paint); 813 virtual void drawPath(const SkPath& path, const SkPaint& paint);
813 814
815 virtual void drawImage(const SkImage* image, SkScalar left, SkScalar top,
816 const SkPaint* paint = NULL);
817
818 virtual void drawImageRect(const SkImage* image, const SkRect* src,
819 const SkRect& dst,
820 const SkPaint* paint = NULL);
821
814 /** Draw the specified bitmap, with its top/left corner at (x,y), using the 822 /** Draw the specified bitmap, with its top/left corner at (x,y), using the
815 specified paint, transformed by the current matrix. Note: if the paint 823 specified paint, transformed by the current matrix. Note: if the paint
816 contains a maskfilter that generates a mask which extends beyond the 824 contains a maskfilter that generates a mask which extends beyond the
817 bitmap's original width/height, then the bitmap will be drawn as if it 825 bitmap's original width/height, then the bitmap will be drawn as if it
818 were in a Shader with CLAMP mode. Thus the color outside of the original 826 were in a Shader with CLAMP mode. Thus the color outside of the original
819 width/height will be the edge color replicated. 827 width/height will be the edge color replicated.
820 828
821 If a shader is present on the paint it will be ignored, except in the 829 If a shader is present on the paint it will be ignored, except in the
822 case where the bitmap is kAlpha_8_SkColorType. In that case, the color i s 830 case where the bitmap is kAlpha_8_SkColorType. In that case, the color i s
823 generated by the shader. 831 generated by the shader.
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 void updateDeviceCMCache(); 1314 void updateDeviceCMCache();
1307 1315
1308 friend class SkDrawIter; // needs setupDrawForLayerDevice() 1316 friend class SkDrawIter; // needs setupDrawForLayerDevice()
1309 friend class AutoDrawLooper; 1317 friend class AutoDrawLooper;
1310 friend class SkLua; // needs top layer size and offset 1318 friend class SkLua; // needs top layer size and offset
1311 friend class SkDebugCanvas; // needs experimental fAllowSimplifyClip 1319 friend class SkDebugCanvas; // needs experimental fAllowSimplifyClip
1312 friend class SkDeferredDevice; // needs getTopDevice() 1320 friend class SkDeferredDevice; // needs getTopDevice()
1313 friend class SkSurface_Raster; // needs getDevice() 1321 friend class SkSurface_Raster; // needs getDevice()
1314 friend class SkRecorder; // InitFlags 1322 friend class SkRecorder; // InitFlags
1315 friend class SkNoSaveLayerCanvas; // InitFlags 1323 friend class SkNoSaveLayerCanvas; // InitFlags
1316 1324
1317 enum InitFlags { 1325 enum InitFlags {
1318 kDefault_InitFlags = 0, 1326 kDefault_InitFlags = 0,
1319 kConservativeRasterClip_InitFlag = 1 << 0, 1327 kConservativeRasterClip_InitFlag = 1 << 0,
1320 }; 1328 };
1321 SkCanvas(int width, int height, InitFlags); 1329 SkCanvas(int width, int height, InitFlags);
1322 SkCanvas(SkBaseDevice*, const SkSurfaceProps*, InitFlags); 1330 SkCanvas(SkBaseDevice*, const SkSurfaceProps*, InitFlags);
1323 SkCanvas(const SkBitmap&, const SkSurfaceProps&); 1331 SkCanvas(const SkBitmap&, const SkSurfaceProps&);
1324 1332
1325 // needs gettotalclip() 1333 // needs gettotalclip()
1326 friend SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas*); 1334 friend SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas*);
1327 1335
1328 SkBaseDevice* createLayerDevice(const SkImageInfo&); 1336 SkBaseDevice* createLayerDevice(const SkImageInfo&);
1329 1337
1330 // call this each time we attach ourselves to a device 1338 // call this each time we attach ourselves to a device
1331 // - constructor 1339 // - constructor
1332 // - internalSaveLayer 1340 // - internalSaveLayer
1333 void setupDevice(SkBaseDevice*); 1341 void setupDevice(SkBaseDevice*);
1334 1342
1335 SkBaseDevice* init(SkBaseDevice*, InitFlags); 1343 SkBaseDevice* init(SkBaseDevice*, InitFlags);
1336 1344
1337 /** 1345 /**
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 1540
1533 class SkCanvasClipVisitor { 1541 class SkCanvasClipVisitor {
1534 public: 1542 public:
1535 virtual ~SkCanvasClipVisitor(); 1543 virtual ~SkCanvasClipVisitor();
1536 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; 1544 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0;
1537 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; 1545 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0;
1538 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; 1546 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0;
1539 }; 1547 };
1540 1548
1541 #endif 1549 #endif
OLDNEW
« no previous file with comments | « gm/multipicturedraw.cpp ('k') | include/core/SkImage.h » ('j') | src/core/SkCanvas.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698