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

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

Issue 1181913003: add SkCanvas::drawAtlas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix warnings Created 5 years, 6 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 | « gyp/SampleApp.gyp ('k') | include/core/SkDevice.h » ('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 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 10 matching lines...) Expand all
21 21
22 class SkBaseDevice; 22 class SkBaseDevice;
23 class SkCanvasClipVisitor; 23 class SkCanvasClipVisitor;
24 class SkDraw; 24 class SkDraw;
25 class SkDrawable; 25 class SkDrawable;
26 class SkDrawFilter; 26 class SkDrawFilter;
27 class SkImage; 27 class SkImage;
28 class SkMetaData; 28 class SkMetaData;
29 class SkPicture; 29 class SkPicture;
30 class SkRRect; 30 class SkRRect;
31 struct SkRSXform;
31 class SkSurface; 32 class SkSurface;
32 class SkSurface_Base; 33 class SkSurface_Base;
33 class SkTextBlob; 34 class SkTextBlob;
34 class GrContext; 35 class GrContext;
35 class GrRenderTarget; 36 class GrRenderTarget;
36 37
37 class SkCanvasState; 38 class SkCanvasState;
38 39
39 /** \class SkCanvas 40 /** \class SkCanvas
40 41
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 @param texCoords specifies the texture coordinates that will be bilerp acro ss the patch, 1018 @param texCoords specifies the texture coordinates that will be bilerp acro ss the patch,
1018 their order is the same as the colors. 1019 their order is the same as the colors.
1019 @param xmode specifies how are the colors and the textures combined if both of them are 1020 @param xmode specifies how are the colors and the textures combined if both of them are
1020 present. 1021 present.
1021 @param paint Specifies the shader/texture if present. 1022 @param paint Specifies the shader/texture if present.
1022 */ 1023 */
1023 void drawPatch(const SkPoint cubics[12], const SkColor colors[4], 1024 void drawPatch(const SkPoint cubics[12], const SkColor colors[4],
1024 const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint); 1025 const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint);
1025 1026
1026 /** 1027 /**
1028 * Draw a set of sprites from the atlas. Each is specified by a tex rectang le in the
1029 * coordinate space of the atlas, and a corresponding xform which transform s the tex rectangle
1030 * into a quad.
1031 *
1032 * xform maps [0, 0, tex.width, tex.height] -> quad
1033 *
1034 * The color array is optional. When specified, each color modulates the pi xels in its
1035 * corresponding quad (via the specified SkXfermode::Mode).
1036 *
1037 * The cullRect is optional. When specified, it must be a conservative boun ds of all of the
1038 * resulting transformed quads, allowing the canvas to skip drawing if the cullRect does not
1039 * intersect the current clip.
1040 *
1041 * The paint is optional. If specified, its antialiasing, alpha, color-filt er, image-filter
1042 * and xfermode are used to affect each of the quads.
1043 */
1044 void drawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect t ex[],
1045 const SkColor colors[], int count, SkXfermode::Mode, const Sk Rect* cullRect,
1046 const SkPaint* paint);
1047
1048 void drawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect t ex[], int count,
1049 const SkRect* cullRect, const SkPaint* paint) {
1050 this->drawAtlas(atlas, xform, tex, NULL, count, SkXfermode::kDst_Mode, c ullRect, paint);
1051 }
1052
1053 /**
1027 * Draw the contents of this drawable into the canvas. If the canvas is asy nc 1054 * Draw the contents of this drawable into the canvas. If the canvas is asy nc
1028 * (e.g. it is recording into a picture) then the drawable will be referenc ed instead, 1055 * (e.g. it is recording into a picture) then the drawable will be referenc ed instead,
1029 * to have its draw() method called when the picture is finalized. 1056 * to have its draw() method called when the picture is finalized.
1030 * 1057 *
1031 * If the intent is to force the contents of the drawable into this canvas immediately, 1058 * If the intent is to force the contents of the drawable into this canvas immediately,
1032 * then drawable->draw(canvas) may be called. 1059 * then drawable->draw(canvas) may be called.
1033 */ 1060 */
1034 void drawDrawable(SkDrawable* drawable); 1061 void drawDrawable(SkDrawable* drawable);
1035 1062
1036 ////////////////////////////////////////////////////////////////////////// 1063 //////////////////////////////////////////////////////////////////////////
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 virtual void onDrawDrawable(SkDrawable*); 1217 virtual void onDrawDrawable(SkDrawable*);
1191 1218
1192 virtual void onDrawPaint(const SkPaint&); 1219 virtual void onDrawPaint(const SkPaint&);
1193 virtual void onDrawRect(const SkRect&, const SkPaint&); 1220 virtual void onDrawRect(const SkRect&, const SkPaint&);
1194 virtual void onDrawOval(const SkRect&, const SkPaint&); 1221 virtual void onDrawOval(const SkRect&, const SkPaint&);
1195 virtual void onDrawRRect(const SkRRect&, const SkPaint&); 1222 virtual void onDrawRRect(const SkRRect&, const SkPaint&);
1196 virtual void onDrawPoints(PointMode, size_t count, const SkPoint pts[], cons t SkPaint&); 1223 virtual void onDrawPoints(PointMode, size_t count, const SkPoint pts[], cons t SkPaint&);
1197 virtual void onDrawVertices(VertexMode, int vertexCount, const SkPoint verti ces[], 1224 virtual void onDrawVertices(VertexMode, int vertexCount, const SkPoint verti ces[],
1198 const SkPoint texs[], const SkColor colors[], Sk Xfermode*, 1225 const SkPoint texs[], const SkColor colors[], Sk Xfermode*,
1199 const uint16_t indices[], int indexCount, const SkPaint&); 1226 const uint16_t indices[], int indexCount, const SkPaint&);
1227
1228 virtual void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[],
1229 int count, SkXfermode::Mode, const SkRect* cull, co nst SkPaint*);
1200 virtual void onDrawPath(const SkPath&, const SkPaint&); 1230 virtual void onDrawPath(const SkPath&, const SkPaint&);
1201 virtual void onDrawImage(const SkImage*, SkScalar dx, SkScalar dy, const SkP aint*); 1231 virtual void onDrawImage(const SkImage*, SkScalar dx, SkScalar dy, const SkP aint*);
1202 virtual void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, c onst SkPaint*); 1232 virtual void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, c onst SkPaint*);
1203 virtual void onDrawBitmap(const SkBitmap&, SkScalar dx, SkScalar dy, const S kPaint*); 1233 virtual void onDrawBitmap(const SkBitmap&, SkScalar dx, SkScalar dy, const S kPaint*);
1204 virtual void onDrawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkPaint*, 1234 virtual void onDrawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkPaint*,
1205 DrawBitmapRectFlags); 1235 DrawBitmapRectFlags);
1206 virtual void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, 1236 virtual void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
1207 const SkPaint*); 1237 const SkPaint*);
1208 virtual void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint* ); 1238 virtual void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint* );
1209 1239
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 1497
1468 class SkCanvasClipVisitor { 1498 class SkCanvasClipVisitor {
1469 public: 1499 public:
1470 virtual ~SkCanvasClipVisitor(); 1500 virtual ~SkCanvasClipVisitor();
1471 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; 1501 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0;
1472 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; 1502 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0;
1473 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; 1503 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0;
1474 }; 1504 };
1475 1505
1476 #endif 1506 #endif
OLDNEW
« no previous file with comments | « gyp/SampleApp.gyp ('k') | include/core/SkDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698