chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame^] | 1 | |
| 2 | /* |
| 3 | * Copyright 2012 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
| 8 | |
| 9 | |
| 10 | #include <cstring> |
| 11 | #include <iostream> |
| 12 | #include <string> |
| 13 | #include "SkDrawCommand.h" |
| 14 | #include "SkObjectParser.h" |
| 15 | |
| 16 | // TODO(chudy): Refactor into non subclass model. |
| 17 | |
| 18 | SkDrawCommand::SkDrawCommand() { |
| 19 | fVisible = true; |
| 20 | } |
| 21 | |
| 22 | SkDrawCommand::~SkDrawCommand() { |
| 23 | } |
| 24 | |
| 25 | const char* SkDrawCommand::GetCommandString(DrawType type) { |
| 26 | switch (type) { |
| 27 | case UNUSED: SkDEBUGFAIL("DrawType UNUSED\n"); break; |
| 28 | case DRAW_CLEAR: return "Clear"; |
| 29 | case CLIP_PATH: return "Clip Path"; |
| 30 | case CLIP_REGION: return "Clip Region"; |
| 31 | case CLIP_RECT: return "Clip Rect"; |
| 32 | case CONCAT: return "Concat"; |
| 33 | case DRAW_BITMAP: return "Draw Bitmap"; |
| 34 | case DRAW_BITMAP_MATRIX: return "Draw Bitmap Matrix"; |
| 35 | case DRAW_BITMAP_NINE: return "Draw Bitmap Nine"; |
| 36 | case DRAW_BITMAP_RECT: return "Draw Bitmap Rect"; |
| 37 | case DRAW_DATA: return "Draw Data"; |
| 38 | case DRAW_PAINT: return "Draw Paint"; |
| 39 | case DRAW_PATH: return "Draw Path"; |
| 40 | case DRAW_PICTURE: return "Draw Picture"; |
| 41 | case DRAW_POINTS: return "Draw Points"; |
| 42 | case DRAW_POS_TEXT: return "Draw Pos Text"; |
| 43 | case DRAW_POS_TEXT_H: return "Draw Pos Text H"; |
| 44 | case DRAW_RECT: return "Draw Rect"; |
| 45 | case DRAW_SPRITE: return "Draw Sprite"; |
| 46 | case DRAW_TEXT: return "Draw Text"; |
| 47 | case DRAW_TEXT_ON_PATH: return "Draw Text On Path"; |
| 48 | case DRAW_VERTICES: return "Draw Vertices"; |
| 49 | case RESTORE: return "Restore"; |
| 50 | case ROTATE: return "Rotate"; |
| 51 | case SAVE: return "Save"; |
| 52 | case SAVE_LAYER: return "Save Layer"; |
| 53 | case SCALE: return "Scale"; |
| 54 | case SET_MATRIX: return "Set Matrix"; |
| 55 | case SKEW: return "Skew"; |
| 56 | case TRANSLATE: return "Translate"; |
| 57 | default: |
| 58 | SkDebugf("DrawType error 0x%08x\n", type); |
| 59 | SkASSERT(0); |
| 60 | break; |
| 61 | } |
| 62 | SkDEBUGFAIL("DrawType UNUSED\n"); |
| 63 | return NULL; |
| 64 | } |
| 65 | |
| 66 | std::string SkDrawCommand::toString() { |
| 67 | std::stringstream ss; |
| 68 | ss << GetCommandString(fDrawType); |
| 69 | return ss.str(); |
| 70 | } |
| 71 | |
| 72 | Clear::Clear(SkColor color) { |
| 73 | this->fColor = color; |
| 74 | this->fDrawType = DRAW_CLEAR; |
| 75 | this->fInfo.push_back(std::string("No Parameters")); |
| 76 | } |
| 77 | |
| 78 | void Clear::execute(SkCanvas* canvas) { |
| 79 | canvas->clear(this->fColor); |
| 80 | } |
| 81 | |
| 82 | ClipPath::ClipPath(const SkPath& path, SkRegion::Op op, bool doAA) { |
| 83 | this->fPath = &path; |
| 84 | this->fOp = op; |
| 85 | this->fDoAA = doAA; |
| 86 | this->fDrawType = CLIP_PATH; |
| 87 | |
| 88 | this->fInfo.push_back(SkObjectParser::PathToString(path)); |
| 89 | this->fInfo.push_back(SkObjectParser::RegionOpToString(op)); |
| 90 | this->fInfo.push_back(SkObjectParser::BoolToString(doAA)); |
| 91 | } |
| 92 | |
| 93 | void ClipPath::execute(SkCanvas* canvas) { |
| 94 | canvas->clipPath(*this->fPath, this->fOp, this->fDoAA); |
| 95 | } |
| 96 | |
| 97 | ClipRegion::ClipRegion(const SkRegion& region, SkRegion::Op op) { |
| 98 | this->fRegion = ®ion; |
| 99 | this->fOp = op; |
| 100 | this->fDrawType = CLIP_REGION; |
| 101 | |
| 102 | this->fInfo.push_back(SkObjectParser::RegionToString(region)); |
| 103 | this->fInfo.push_back(SkObjectParser::RegionOpToString(op)); |
| 104 | } |
| 105 | |
| 106 | void ClipRegion::execute(SkCanvas* canvas) { |
| 107 | canvas->clipRegion(*this->fRegion, this->fOp); |
| 108 | } |
| 109 | |
| 110 | ClipRect::ClipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { |
| 111 | this->fRect = ▭ |
| 112 | this->fOp = op; |
| 113 | this->fDoAA = doAA; |
| 114 | this->fDrawType = CLIP_RECT; |
| 115 | |
| 116 | this->fInfo.push_back(SkObjectParser::RectToString(rect)); |
| 117 | this->fInfo.push_back(SkObjectParser::RegionOpToString(op)); |
| 118 | this->fInfo.push_back(SkObjectParser::BoolToString(doAA)); |
| 119 | } |
| 120 | |
| 121 | void ClipRect::execute(SkCanvas* canvas) { |
| 122 | canvas->clipRect(*this->fRect, this->fOp, this->fDoAA); |
| 123 | } |
| 124 | |
| 125 | Concat::Concat(const SkMatrix& matrix) { |
| 126 | this->fMatrix = &matrix; |
| 127 | this->fDrawType = CONCAT; |
| 128 | |
| 129 | this->fInfo.push_back(SkObjectParser::MatrixToString(matrix)); |
| 130 | } |
| 131 | |
| 132 | void Concat::execute(SkCanvas* canvas) { |
| 133 | canvas->concat(*this->fMatrix); |
| 134 | } |
| 135 | |
| 136 | DrawBitmap::DrawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, |
| 137 | const SkPaint* paint) { |
| 138 | this->fBitmap = &bitmap; |
| 139 | this->fLeft = left; |
| 140 | this->fTop = top; |
| 141 | this->fPaint = paint; |
| 142 | this->fDrawType = DRAW_BITMAP; |
| 143 | |
| 144 | this->fInfo.push_back(SkObjectParser::BitmapToString(bitmap)); |
| 145 | this->fInfo.push_back(SkObjectParser::ScalarToString(left, "SkScalar left: ")); |
| 146 | this->fInfo.push_back(SkObjectParser::ScalarToString(top, "SkScalar top: ")); |
| 147 | } |
| 148 | |
| 149 | void DrawBitmap::execute(SkCanvas* canvas) { |
| 150 | canvas->drawBitmap(*this->fBitmap, this->fLeft, this->fTop, this->fPaint); |
| 151 | } |
| 152 | |
| 153 | DrawBitmapMatrix::DrawBitmapMatrix(const SkBitmap& bitmap, |
| 154 | const SkMatrix& matrix, const SkPaint* paint) { |
| 155 | this->fBitmap = &bitmap; |
| 156 | this->fMatrix = &matrix; |
| 157 | this->fPaint = paint; |
| 158 | this->fDrawType = DRAW_BITMAP_MATRIX; |
| 159 | |
| 160 | this->fInfo.push_back(SkObjectParser::BitmapToString(bitmap)); |
| 161 | this->fInfo.push_back(SkObjectParser::MatrixToString(matrix)); |
| 162 | if (paint) this->fInfo.push_back(SkObjectParser::PaintToString(*paint)); |
| 163 | } |
| 164 | |
| 165 | void DrawBitmapMatrix::execute(SkCanvas* canvas) { |
| 166 | canvas->drawBitmapMatrix(*this->fBitmap, *this->fMatrix, this->fPaint); |
| 167 | } |
| 168 | |
| 169 | DrawBitmapNine::DrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, |
| 170 | const SkRect& dst, const SkPaint* paint) { |
| 171 | this->fBitmap = &bitmap; |
| 172 | this->fCenter = ¢er; |
| 173 | this->fDst = &dst; |
| 174 | this->fPaint = paint; |
| 175 | this->fDrawType = DRAW_BITMAP_NINE; |
| 176 | |
| 177 | this->fInfo.push_back(SkObjectParser::BitmapToString(bitmap)); |
| 178 | this->fInfo.push_back(SkObjectParser::IRectToString(center)); |
| 179 | this->fInfo.push_back(SkObjectParser::RectToString(dst)); |
| 180 | if (paint) this->fInfo.push_back(SkObjectParser::PaintToString(*paint)); |
| 181 | } |
| 182 | |
| 183 | void DrawBitmapNine::execute(SkCanvas* canvas) { |
| 184 | canvas->drawBitmapNine(*this->fBitmap, *this->fCenter, *this->fDst, this->fPaint); |
| 185 | } |
| 186 | |
| 187 | DrawBitmapRect::DrawBitmapRect(const SkBitmap& bitmap, const SkIRect* src, |
| 188 | const SkRect& dst, const SkPaint* paint) { |
| 189 | this->fBitmap = &bitmap; |
| 190 | this->fSrc = src; |
| 191 | this->fDst = &dst; |
| 192 | this->fPaint = paint; |
| 193 | this->fDrawType = DRAW_BITMAP_RECT; |
| 194 | |
| 195 | this->fInfo.push_back(SkObjectParser::BitmapToString(bitmap)); |
| 196 | if (src) this->fInfo.push_back(SkObjectParser::IRectToString(*src)); |
| 197 | this->fInfo.push_back(SkObjectParser::RectToString(dst)); |
| 198 | if (paint) this->fInfo.push_back(SkObjectParser::PaintToString(*paint)); |
| 199 | } |
| 200 | |
| 201 | void DrawBitmapRect::execute(SkCanvas* canvas) { |
| 202 | canvas->drawBitmapRect(*this->fBitmap, this->fSrc, *this->fDst, this->fPaint); |
| 203 | } |
| 204 | |
| 205 | DrawData::DrawData(const void* data, size_t length) { |
| 206 | this->fData = data; |
| 207 | this->fLength = length; |
| 208 | this->fDrawType = DRAW_DATA; |
| 209 | // TODO(chudy): See if we can't display data and length. |
| 210 | } |
| 211 | |
| 212 | void DrawData::execute(SkCanvas* canvas) { |
| 213 | canvas->drawData(this->fData, this->fLength); |
| 214 | } |
| 215 | |
| 216 | DrawPaint::DrawPaint(const SkPaint& paint) { |
| 217 | this->fPaint = &paint; |
| 218 | this->fDrawType = DRAW_PAINT; |
| 219 | |
| 220 | this->fInfo.push_back(SkObjectParser::PaintToString(paint)); |
| 221 | } |
| 222 | |
| 223 | void DrawPaint::execute(SkCanvas* canvas) { |
| 224 | canvas->drawPaint(*this->fPaint); |
| 225 | } |
| 226 | |
| 227 | DrawPath::DrawPath(const SkPath& path, const SkPaint& paint) { |
| 228 | this->fPath = &path; |
| 229 | this->fPaint = &paint; |
| 230 | this->fDrawType = DRAW_PATH; |
| 231 | |
| 232 | this->fInfo.push_back(SkObjectParser::PathToString(path)); |
| 233 | this->fInfo.push_back(SkObjectParser::PaintToString(paint)); |
| 234 | } |
| 235 | |
| 236 | void DrawPath::execute(SkCanvas* canvas) { |
| 237 | canvas->drawPath(*this->fPath, *this->fPaint); |
| 238 | } |
| 239 | |
| 240 | DrawPicture::DrawPicture(SkPicture& picture) { |
| 241 | this->fPicture = &picture; |
| 242 | this->fDrawType = DRAW_PICTURE; |
| 243 | this->fInfo.push_back(std::string("Data unavailable. To be implemented")); |
| 244 | } |
| 245 | |
| 246 | void DrawPicture::execute(SkCanvas* canvas) { |
| 247 | canvas->drawPicture(*this->fPicture); |
| 248 | } |
| 249 | |
| 250 | DrawPoints::DrawPoints(SkCanvas::PointMode mode, size_t count, |
| 251 | const SkPoint pts[], const SkPaint& paint) { |
| 252 | this->fMode = mode; |
| 253 | this->fCount = count; |
| 254 | this->fPts = pts; |
| 255 | this->fPaint = &paint; |
| 256 | this->fDrawType = DRAW_POINTS; |
| 257 | |
| 258 | this->fInfo.push_back(SkObjectParser::PointsToString(pts, count)); |
| 259 | } |
| 260 | |
| 261 | void DrawPoints::execute(SkCanvas* canvas) { |
| 262 | canvas->drawPoints(this->fMode, this->fCount, this->fPts, *this->fPaint); |
| 263 | } |
| 264 | |
| 265 | DrawPosText::DrawPosText(const void* text, size_t byteLength, const SkPoint pos[], |
| 266 | const SkPaint& paint) { |
| 267 | this->fText = text; |
| 268 | this->fByteLength = byteLength; |
| 269 | this->fPos = pos; |
| 270 | this->fPaint = &paint; |
| 271 | this->fDrawType = DRAW_POS_TEXT; |
| 272 | |
| 273 | this->fInfo.push_back(SkObjectParser::TextToString(text, byteLength)); |
| 274 | // TODO(chudy): Test that this works. |
| 275 | this->fInfo.push_back(SkObjectParser::PointsToString(pos, 1)); |
| 276 | this->fInfo.push_back(SkObjectParser::PaintToString(paint)); |
| 277 | } |
| 278 | |
| 279 | void DrawPosText::execute(SkCanvas* canvas) { |
| 280 | canvas->drawPosText(this->fText, this->fByteLength, this->fPos, *this->fPaint); |
| 281 | } |
| 282 | |
| 283 | |
| 284 | DrawPosTextH::DrawPosTextH(const void* text, size_t byteLength, |
| 285 | const SkScalar xpos[], SkScalar constY, const SkPaint& paint) { |
| 286 | this->fText = text; |
| 287 | this->fByteLength = byteLength; |
| 288 | this->fXpos = xpos; |
| 289 | this->fConstY = constY; |
| 290 | this->fPaint = &paint; |
| 291 | this->fDrawType = DRAW_POS_TEXT_H; |
| 292 | |
| 293 | this->fInfo.push_back(SkObjectParser::TextToString(text, byteLength)); |
| 294 | this->fInfo.push_back(SkObjectParser::ScalarToString(xpos[0], "XPOS: ")); |
| 295 | this->fInfo.push_back(SkObjectParser::ScalarToString(constY, "SkScalar constY: ")); |
| 296 | this->fInfo.push_back(SkObjectParser::PaintToString(paint)); |
| 297 | } |
| 298 | |
| 299 | void DrawPosTextH::execute(SkCanvas* canvas) { |
| 300 | canvas->drawPosTextH(this->fText, this->fByteLength, this->fXpos, this->fConstY, |
| 301 | *this->fPaint); |
| 302 | } |
| 303 | |
| 304 | DrawRectC::DrawRectC(const SkRect& rect, const SkPaint& paint) { |
| 305 | this->fRect = ▭ |
| 306 | this->fPaint = &paint; |
| 307 | this->fDrawType = DRAW_RECT; |
| 308 | |
| 309 | this->fInfo.push_back(SkObjectParser::RectToString(rect)); |
| 310 | this->fInfo.push_back(SkObjectParser::PaintToString(paint)); |
| 311 | } |
| 312 | |
| 313 | void DrawRectC::execute(SkCanvas* canvas) { |
| 314 | canvas->drawRect(*this->fRect, *this->fPaint); |
| 315 | } |
| 316 | |
| 317 | DrawSprite::DrawSprite(const SkBitmap& bitmap, int left, int top, |
| 318 | const SkPaint* paint) { |
| 319 | this->fBitmap = &bitmap; |
| 320 | this->fLeft = left; |
| 321 | this->fTop = top; |
| 322 | this->fPaint = paint; |
| 323 | this->fDrawType = DRAW_SPRITE; |
| 324 | |
| 325 | this->fInfo.push_back(SkObjectParser::BitmapToString(bitmap)); |
| 326 | this->fInfo.push_back(SkObjectParser::IntToString(left, "Left: ")); |
| 327 | this->fInfo.push_back(SkObjectParser::IntToString(top, "Top: ")); |
| 328 | } |
| 329 | |
| 330 | void DrawSprite::execute(SkCanvas* canvas) { |
| 331 | canvas->drawSprite(*this->fBitmap, this->fLeft, this->fTop, this->fPaint); |
| 332 | } |
| 333 | |
| 334 | DrawTextC::DrawTextC(const void* text, size_t byteLength, SkScalar x, SkScalar y, |
| 335 | const SkPaint& paint) { |
| 336 | this->fText = text; |
| 337 | this->fByteLength = byteLength; |
| 338 | this->fX = x; |
| 339 | this->fY = y; |
| 340 | this->fPaint = &paint; |
| 341 | this->fDrawType = DRAW_TEXT; |
| 342 | |
| 343 | this->fInfo.push_back(SkObjectParser::TextToString(text, byteLength)); |
| 344 | this->fInfo.push_back(SkObjectParser::ScalarToString(x, "SkScalar x: ")); |
| 345 | this->fInfo.push_back(SkObjectParser::ScalarToString(y, "SkScalar y: ")); |
| 346 | this->fInfo.push_back(SkObjectParser::PaintToString(paint)); |
| 347 | } |
| 348 | |
| 349 | void DrawTextC::execute(SkCanvas* canvas) { |
| 350 | canvas->drawText(this->fText, this->fByteLength, this->fX, this->fY, *this->fPaint); |
| 351 | } |
| 352 | |
| 353 | DrawTextOnPath::DrawTextOnPath(const void* text, size_t byteLength, |
| 354 | const SkPath& path, const SkMatrix* matrix, const SkPaint& paint) { |
| 355 | this->fText = text; |
| 356 | this->fByteLength = byteLength; |
| 357 | this->fPath = &path; |
| 358 | this->fMatrix = matrix; |
| 359 | this->fPaint = &paint; |
| 360 | this->fDrawType = DRAW_TEXT_ON_PATH; |
| 361 | |
| 362 | this->fInfo.push_back(SkObjectParser::TextToString(text, byteLength)); |
| 363 | this->fInfo.push_back(SkObjectParser::PathToString(path)); |
| 364 | if (matrix) this->fInfo.push_back(SkObjectParser::MatrixToString(*matrix)); |
| 365 | this->fInfo.push_back(SkObjectParser::PaintToString(paint)); |
| 366 | } |
| 367 | |
| 368 | void DrawTextOnPath::execute(SkCanvas* canvas) { |
| 369 | canvas->drawTextOnPath(this->fText, this->fByteLength, *this->fPath, |
| 370 | this->fMatrix, *this->fPaint); |
| 371 | } |
| 372 | |
| 373 | DrawVertices::DrawVertices(SkCanvas::VertexMode vmode, int vertexCount, |
| 374 | const SkPoint vertices[], const SkPoint texs[], const SkColor colors[], |
| 375 | SkXfermode* xfermode, const uint16_t indices[], int indexCount, |
| 376 | const SkPaint& paint) { |
| 377 | this->fVmode = vmode; |
| 378 | this->fVertexCount = vertexCount; |
| 379 | this->fTexs = texs; |
| 380 | this->fColors = colors; |
| 381 | this->fXfermode = xfermode; |
| 382 | this->fIndices = indices; |
| 383 | this->fIndexCount = indexCount; |
| 384 | this->fPaint = &paint; |
| 385 | this->fDrawType = DRAW_VERTICES; |
| 386 | // TODO(chudy) |
| 387 | this->fInfo.push_back(std::string("To be implemented")); |
| 388 | } |
| 389 | |
| 390 | void DrawVertices::execute(SkCanvas* canvas) { |
| 391 | canvas->drawVertices(this->fVmode, this->fVertexCount, this->fVertices, |
| 392 | this->fTexs, this->fColors, this->fXfermode, this->fIndices, |
| 393 | this->fIndexCount, *this->fPaint); |
| 394 | } |
| 395 | |
| 396 | Restore::Restore() { |
| 397 | this->fDrawType = RESTORE; |
| 398 | this->fInfo.push_back(std::string("No Parameters")); |
| 399 | } |
| 400 | |
| 401 | void Restore::execute(SkCanvas* canvas) { |
| 402 | canvas->restore(); |
| 403 | } |
| 404 | |
| 405 | Rotate::Rotate(SkScalar degrees) { |
| 406 | this->fDegrees = degrees; |
| 407 | this->fDrawType = ROTATE; |
| 408 | |
| 409 | this->fInfo.push_back(SkObjectParser::ScalarToString(degrees, "SkScalar degrees: ")); |
| 410 | } |
| 411 | |
| 412 | void Rotate::execute(SkCanvas* canvas) { |
| 413 | canvas->rotate(this->fDegrees); |
| 414 | } |
| 415 | |
| 416 | Save::Save(SkCanvas::SaveFlags flags) { |
| 417 | this->fFlags = flags; |
| 418 | this->fDrawType = SAVE; |
| 419 | |
| 420 | this->fInfo.push_back(SkObjectParser::SaveFlagsToString(flags)); |
| 421 | } |
| 422 | |
| 423 | void Save::execute(SkCanvas* canvas) { |
| 424 | canvas->save(this->fFlags); |
| 425 | } |
| 426 | |
| 427 | SaveLayer::SaveLayer(const SkRect* bounds, const SkPaint* paint, |
| 428 | SkCanvas::SaveFlags flags) { |
| 429 | this->fBounds = bounds; |
| 430 | this->fPaint = paint; |
| 431 | this->fFlags = flags; |
| 432 | this->fDrawType = SAVE_LAYER; |
| 433 | |
| 434 | if (bounds) this->fInfo.push_back(SkObjectParser::RectToString(*bounds)); |
| 435 | if (paint) this->fInfo.push_back(SkObjectParser::PaintToString(*paint)); |
| 436 | this->fInfo.push_back(SkObjectParser::SaveFlagsToString(flags)); |
| 437 | } |
| 438 | |
| 439 | void SaveLayer::execute(SkCanvas* canvas) { |
| 440 | canvas->saveLayer(this->fBounds, this->fPaint, this->fFlags); |
| 441 | } |
| 442 | |
| 443 | Scale::Scale(SkScalar sx, SkScalar sy) { |
| 444 | this->fSx = sx; |
| 445 | this->fSy = sy; |
| 446 | this->fDrawType = SCALE; |
| 447 | |
| 448 | this->fInfo.push_back(SkObjectParser::ScalarToString(sx, "SkScalar sx: ")); |
| 449 | this->fInfo.push_back(SkObjectParser::ScalarToString(sy, "SkScalar sy: ")); |
| 450 | } |
| 451 | |
| 452 | void Scale::execute(SkCanvas* canvas) { |
| 453 | canvas->scale(this->fSx, this->fSy); |
| 454 | } |
| 455 | |
| 456 | SetMatrix::SetMatrix(const SkMatrix& matrix) { |
| 457 | this->fMatrix = &matrix; |
| 458 | this->fDrawType = SET_MATRIX; |
| 459 | |
| 460 | this->fInfo.push_back(SkObjectParser::MatrixToString(matrix)); |
| 461 | } |
| 462 | |
| 463 | void SetMatrix::execute(SkCanvas* canvas) { |
| 464 | canvas->setMatrix(*this->fMatrix); |
| 465 | } |
| 466 | |
| 467 | Skew::Skew(SkScalar sx, SkScalar sy) { |
| 468 | this->fSx = sx; |
| 469 | this->fSy = sy; |
| 470 | this->fDrawType = SKEW; |
| 471 | |
| 472 | this->fInfo.push_back(SkObjectParser::ScalarToString(sx, "SkScalar sx: ")); |
| 473 | this->fInfo.push_back(SkObjectParser::ScalarToString(sy, "SkScalar sy: ")); |
| 474 | } |
| 475 | |
| 476 | void Skew::execute(SkCanvas* canvas) { |
| 477 | canvas->skew(this->fSx, this->fSy); |
| 478 | } |
| 479 | |
| 480 | Translate::Translate(SkScalar dx, SkScalar dy) { |
| 481 | this->fDx = dx; |
| 482 | this->fDy = dy; |
| 483 | this->fDrawType = TRANSLATE; |
| 484 | |
| 485 | this->fInfo.push_back(SkObjectParser::ScalarToString(dx, "SkScalar dx: ")); |
| 486 | this->fInfo.push_back(SkObjectParser::ScalarToString(dy, "SkScalar dy: ")); |
| 487 | } |
| 488 | |
| 489 | void Translate::execute(SkCanvas* canvas) { |
| 490 | canvas->translate(this->fDx, this->fDy); |
| 491 | } |