Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 | |
|
robertphillips
2015/06/24 15:11:02
kDst_Mode ?
reed1
2015/06/24 16:17:48
Done.
| |
| 1035 * corresponding quad (via SkXfermode::kModulate_Mode). As a simple example , passing white | |
| 1036 * but with a non-opaque alpha will result in fading the quad. | |
|
robertphillips
2015/06/24 15:11:02
* If an explicit xfer mode is provided it ...
reed1
2015/06/24 16:17:47
Done.
| |
| 1037 * | |
| 1038 * The cullRect is optional. When specified, it must be a conservative boun ds of all of the | |
| 1039 * resulting transformed quads, allowing the canvas to skip drawing if the cullRect does not | |
| 1040 * intersect the current clip. | |
| 1041 * | |
| 1042 * The paint is optional. If specified, its antialiasing, alpha, color-filt er, image-filter | |
| 1043 * and xfermode are used to affect each of the quads. | |
| 1044 */ | |
| 1045 void drawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect t ex[], | |
| 1046 const SkColor colors[], int count, SkXfermode::Mode, const Sk Rect* cullRect, | |
| 1047 const SkPaint* paint); | |
| 1048 | |
| 1049 void drawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect t ex[], int count, | |
| 1050 const SkRect* cullRect, const SkPaint* paint) { | |
| 1051 this->drawAtlas(atlas, xform, tex, NULL, count, SkXfermode::kDst_Mode, c ullRect, paint); | |
| 1052 } | |
| 1053 | |
| 1054 /** | |
| 1027 * Draw the contents of this drawable into the canvas. If the canvas is asy nc | 1055 * 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, | 1056 * (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. | 1057 * to have its draw() method called when the picture is finalized. |
| 1030 * | 1058 * |
| 1031 * If the intent is to force the contents of the drawable into this canvas immediately, | 1059 * If the intent is to force the contents of the drawable into this canvas immediately, |
| 1032 * then drawable->draw(canvas) may be called. | 1060 * then drawable->draw(canvas) may be called. |
| 1033 */ | 1061 */ |
| 1034 void drawDrawable(SkDrawable* drawable); | 1062 void drawDrawable(SkDrawable* drawable); |
| 1035 | 1063 |
| 1036 ////////////////////////////////////////////////////////////////////////// | 1064 ////////////////////////////////////////////////////////////////////////// |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1190 virtual void onDrawDrawable(SkDrawable*); | 1218 virtual void onDrawDrawable(SkDrawable*); |
| 1191 | 1219 |
| 1192 virtual void onDrawPaint(const SkPaint&); | 1220 virtual void onDrawPaint(const SkPaint&); |
| 1193 virtual void onDrawRect(const SkRect&, const SkPaint&); | 1221 virtual void onDrawRect(const SkRect&, const SkPaint&); |
| 1194 virtual void onDrawOval(const SkRect&, const SkPaint&); | 1222 virtual void onDrawOval(const SkRect&, const SkPaint&); |
| 1195 virtual void onDrawRRect(const SkRRect&, const SkPaint&); | 1223 virtual void onDrawRRect(const SkRRect&, const SkPaint&); |
| 1196 virtual void onDrawPoints(PointMode, size_t count, const SkPoint pts[], cons t SkPaint&); | 1224 virtual void onDrawPoints(PointMode, size_t count, const SkPoint pts[], cons t SkPaint&); |
| 1197 virtual void onDrawVertices(VertexMode, int vertexCount, const SkPoint verti ces[], | 1225 virtual void onDrawVertices(VertexMode, int vertexCount, const SkPoint verti ces[], |
| 1198 const SkPoint texs[], const SkColor colors[], Sk Xfermode*, | 1226 const SkPoint texs[], const SkColor colors[], Sk Xfermode*, |
| 1199 const uint16_t indices[], int indexCount, const SkPaint&); | 1227 const uint16_t indices[], int indexCount, const SkPaint&); |
| 1228 | |
| 1229 virtual void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], | |
| 1230 int count, SkXfermode::Mode, const SkRect* cull, co nst SkPaint*); | |
| 1200 virtual void onDrawPath(const SkPath&, const SkPaint&); | 1231 virtual void onDrawPath(const SkPath&, const SkPaint&); |
| 1201 virtual void onDrawImage(const SkImage*, SkScalar dx, SkScalar dy, const SkP aint*); | 1232 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*); | 1233 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*); | 1234 virtual void onDrawBitmap(const SkBitmap&, SkScalar dx, SkScalar dy, const S kPaint*); |
| 1204 virtual void onDrawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkPaint*, | 1235 virtual void onDrawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkPaint*, |
| 1205 DrawBitmapRectFlags); | 1236 DrawBitmapRectFlags); |
| 1206 virtual void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, | 1237 virtual void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, |
| 1207 const SkPaint*); | 1238 const SkPaint*); |
| 1208 virtual void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint* ); | 1239 virtual void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint* ); |
| 1209 | 1240 |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1467 | 1498 |
| 1468 class SkCanvasClipVisitor { | 1499 class SkCanvasClipVisitor { |
| 1469 public: | 1500 public: |
| 1470 virtual ~SkCanvasClipVisitor(); | 1501 virtual ~SkCanvasClipVisitor(); |
| 1471 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1502 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
| 1472 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1503 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
| 1473 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1504 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
| 1474 }; | 1505 }; |
| 1475 | 1506 |
| 1476 #endif | 1507 #endif |
| OLD | NEW |