| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 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 "SkBigPicture.h" | 8 #include "SkBigPicture.h" |
| 9 #include "SkCanvasPriv.h" | 9 #include "SkCanvasPriv.h" |
| 10 #include "SkPatchUtils.h" | 10 #include "SkPatchUtils.h" |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 if (fDrawPictureMode == Record_DrawPictureMode) { | 298 if (fDrawPictureMode == Record_DrawPictureMode) { |
| 299 fApproxBytesUsedBySubPictures += SkPictureUtils::ApproximateBytesUsed(pi
c); | 299 fApproxBytesUsedBySubPictures += SkPictureUtils::ApproximateBytesUsed(pi
c); |
| 300 APPEND(DrawPicture, this->copy(paint), pic, matrix ? *matrix : SkMatrix:
:I()); | 300 APPEND(DrawPicture, this->copy(paint), pic, matrix ? *matrix : SkMatrix:
:I()); |
| 301 } else { | 301 } else { |
| 302 SkASSERT(fDrawPictureMode == Playback_DrawPictureMode); | 302 SkASSERT(fDrawPictureMode == Playback_DrawPictureMode); |
| 303 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, pic->cullRect()); | 303 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, pic->cullRect()); |
| 304 pic->playback(this); | 304 pic->playback(this); |
| 305 } | 305 } |
| 306 } | 306 } |
| 307 | 307 |
| 308 void SkRecorder::onDrawShadowedPicture(const SkPicture* pic, |
| 309 const SkMatrix* matrix, |
| 310 const SkPaint* paint) { |
| 311 if (fDrawPictureMode == Record_DrawPictureMode) { |
| 312 fApproxBytesUsedBySubPictures += SkPictureUtils::ApproximateBytesUsed(pi
c); |
| 313 APPEND(DrawShadowedPicture, this->copy(paint), pic, matrix ? *matrix : S
kMatrix::I()); |
| 314 } else { |
| 315 SkASSERT(fDrawPictureMode == Playback_DrawPictureMode); |
| 316 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, pic->cullRect()); |
| 317 pic->playback(this); |
| 318 } |
| 319 } |
| 320 |
| 321 |
| 308 void SkRecorder::onDrawVertices(VertexMode vmode, | 322 void SkRecorder::onDrawVertices(VertexMode vmode, |
| 309 int vertexCount, const SkPoint vertices[], | 323 int vertexCount, const SkPoint vertices[], |
| 310 const SkPoint texs[], const SkColor colors[], | 324 const SkPoint texs[], const SkColor colors[], |
| 311 SkXfermode* xmode, | 325 SkXfermode* xmode, |
| 312 const uint16_t indices[], int indexCount, const
SkPaint& paint) { | 326 const uint16_t indices[], int indexCount, const
SkPaint& paint) { |
| 313 APPEND(DrawVertices, paint, | 327 APPEND(DrawVertices, paint, |
| 314 vmode, | 328 vmode, |
| 315 vertexCount, | 329 vertexCount, |
| 316 this->copy(vertices, vertexCount), | 330 this->copy(vertices, vertexCount), |
| 317 texs ? this->copy(texs, vertexCount) : nullptr, | 331 texs ? this->copy(texs, vertexCount) : nullptr, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 } | 376 } |
| 363 | 377 |
| 364 void SkRecorder::didConcat(const SkMatrix& matrix) { | 378 void SkRecorder::didConcat(const SkMatrix& matrix) { |
| 365 APPEND(Concat, matrix); | 379 APPEND(Concat, matrix); |
| 366 } | 380 } |
| 367 | 381 |
| 368 void SkRecorder::didSetMatrix(const SkMatrix& matrix) { | 382 void SkRecorder::didSetMatrix(const SkMatrix& matrix) { |
| 369 APPEND(SetMatrix, matrix); | 383 APPEND(SetMatrix, matrix); |
| 370 } | 384 } |
| 371 | 385 |
| 372 void SkRecorder::didTranslateZ(SkScalar z) { | 386 void SkRecorder::didTranslateZ(SkScalar z) { |
| 387 #ifdef SK_USE_SHADOWS |
| 373 APPEND(TranslateZ, z); | 388 APPEND(TranslateZ, z); |
| 389 #endif |
| 374 } | 390 } |
| 375 | 391 |
| 376 void SkRecorder::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e
dgeStyle) { | 392 void SkRecorder::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e
dgeStyle) { |
| 377 INHERITED(onClipRect, rect, op, edgeStyle); | 393 INHERITED(onClipRect, rect, op, edgeStyle); |
| 378 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle); | 394 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle); |
| 379 APPEND(ClipRect, this->devBounds(), rect, opAA); | 395 APPEND(ClipRect, this->devBounds(), rect, opAA); |
| 380 } | 396 } |
| 381 | 397 |
| 382 void SkRecorder::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl
e edgeStyle) { | 398 void SkRecorder::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl
e edgeStyle) { |
| 383 INHERITED(onClipRRect, rrect, op, edgeStyle); | 399 INHERITED(onClipRRect, rrect, op, edgeStyle); |
| 384 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle); | 400 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle); |
| 385 APPEND(ClipRRect, this->devBounds(), rrect, opAA); | 401 APPEND(ClipRRect, this->devBounds(), rrect, opAA); |
| 386 } | 402 } |
| 387 | 403 |
| 388 void SkRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e
dgeStyle) { | 404 void SkRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e
dgeStyle) { |
| 389 INHERITED(onClipPath, path, op, edgeStyle); | 405 INHERITED(onClipPath, path, op, edgeStyle); |
| 390 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle); | 406 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle); |
| 391 APPEND(ClipPath, this->devBounds(), path, opAA); | 407 APPEND(ClipPath, this->devBounds(), path, opAA); |
| 392 } | 408 } |
| 393 | 409 |
| 394 void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { | 410 void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { |
| 395 INHERITED(onClipRegion, deviceRgn, op); | 411 INHERITED(onClipRegion, deviceRgn, op); |
| 396 APPEND(ClipRegion, this->devBounds(), deviceRgn, op); | 412 APPEND(ClipRegion, this->devBounds(), deviceRgn, op); |
| 397 } | 413 } |
| 398 | 414 |
| 399 sk_sp<SkSurface> SkRecorder::onNewSurface(const SkImageInfo&, const SkSurfacePro
ps&) { | 415 sk_sp<SkSurface> SkRecorder::onNewSurface(const SkImageInfo&, const SkSurfacePro
ps&) { |
| 400 return nullptr; | 416 return nullptr; |
| 401 } | 417 } |
| OLD | NEW |