| 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 | |
| 322 void SkRecorder::onDrawVertices(VertexMode vmode, | 308 void SkRecorder::onDrawVertices(VertexMode vmode, |
| 323 int vertexCount, const SkPoint vertices[], | 309 int vertexCount, const SkPoint vertices[], |
| 324 const SkPoint texs[], const SkColor colors[], | 310 const SkPoint texs[], const SkColor colors[], |
| 325 SkXfermode* xmode, | 311 SkXfermode* xmode, |
| 326 const uint16_t indices[], int indexCount, const
SkPaint& paint) { | 312 const uint16_t indices[], int indexCount, const
SkPaint& paint) { |
| 327 APPEND(DrawVertices, paint, | 313 APPEND(DrawVertices, paint, |
| 328 vmode, | 314 vmode, |
| 329 vertexCount, | 315 vertexCount, |
| 330 this->copy(vertices, vertexCount), | 316 this->copy(vertices, vertexCount), |
| 331 texs ? this->copy(texs, vertexCount) : nullptr, | 317 texs ? this->copy(texs, vertexCount) : nullptr, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 } | 362 } |
| 377 | 363 |
| 378 void SkRecorder::didConcat(const SkMatrix& matrix) { | 364 void SkRecorder::didConcat(const SkMatrix& matrix) { |
| 379 APPEND(Concat, matrix); | 365 APPEND(Concat, matrix); |
| 380 } | 366 } |
| 381 | 367 |
| 382 void SkRecorder::didSetMatrix(const SkMatrix& matrix) { | 368 void SkRecorder::didSetMatrix(const SkMatrix& matrix) { |
| 383 APPEND(SetMatrix, matrix); | 369 APPEND(SetMatrix, matrix); |
| 384 } | 370 } |
| 385 | 371 |
| 386 void SkRecorder::didTranslateZ(SkScalar z) { | 372 void SkRecorder::didTranslateZ(SkScalar z) { |
| 387 #ifdef SK_EXPERIMENTAL_SHADOWING | |
| 388 APPEND(TranslateZ, z); | 373 APPEND(TranslateZ, z); |
| 389 #endif | |
| 390 } | 374 } |
| 391 | 375 |
| 392 void SkRecorder::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e
dgeStyle) { | 376 void SkRecorder::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e
dgeStyle) { |
| 393 INHERITED(onClipRect, rect, op, edgeStyle); | 377 INHERITED(onClipRect, rect, op, edgeStyle); |
| 394 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle); | 378 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle); |
| 395 APPEND(ClipRect, this->devBounds(), rect, opAA); | 379 APPEND(ClipRect, this->devBounds(), rect, opAA); |
| 396 } | 380 } |
| 397 | 381 |
| 398 void SkRecorder::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl
e edgeStyle) { | 382 void SkRecorder::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl
e edgeStyle) { |
| 399 INHERITED(onClipRRect, rrect, op, edgeStyle); | 383 INHERITED(onClipRRect, rrect, op, edgeStyle); |
| 400 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle); | 384 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle); |
| 401 APPEND(ClipRRect, this->devBounds(), rrect, opAA); | 385 APPEND(ClipRRect, this->devBounds(), rrect, opAA); |
| 402 } | 386 } |
| 403 | 387 |
| 404 void SkRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e
dgeStyle) { | 388 void SkRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e
dgeStyle) { |
| 405 INHERITED(onClipPath, path, op, edgeStyle); | 389 INHERITED(onClipPath, path, op, edgeStyle); |
| 406 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle); | 390 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle); |
| 407 APPEND(ClipPath, this->devBounds(), path, opAA); | 391 APPEND(ClipPath, this->devBounds(), path, opAA); |
| 408 } | 392 } |
| 409 | 393 |
| 410 void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { | 394 void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { |
| 411 INHERITED(onClipRegion, deviceRgn, op); | 395 INHERITED(onClipRegion, deviceRgn, op); |
| 412 APPEND(ClipRegion, this->devBounds(), deviceRgn, op); | 396 APPEND(ClipRegion, this->devBounds(), deviceRgn, op); |
| 413 } | 397 } |
| 414 | 398 |
| 415 sk_sp<SkSurface> SkRecorder::onNewSurface(const SkImageInfo&, const SkSurfacePro
ps&) { | 399 sk_sp<SkSurface> SkRecorder::onNewSurface(const SkImageInfo&, const SkSurfacePro
ps&) { |
| 416 return nullptr; | 400 return nullptr; |
| 417 } | 401 } |
| OLD | NEW |