Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkBitmapHeap.h" | 10 #include "SkBitmapHeap.h" |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 401 SkRRect outer, inner; | 401 SkRRect outer, inner; |
| 402 reader->readRRect(&outer); | 402 reader->readRRect(&outer); |
| 403 reader->readRRect(&inner); | 403 reader->readRRect(&inner); |
| 404 if (state->shouldDraw()) { | 404 if (state->shouldDraw()) { |
| 405 canvas->drawDRRect(outer, inner, state->paint()); | 405 canvas->drawDRRect(outer, inner, state->paint()); |
| 406 } | 406 } |
| 407 } | 407 } |
| 408 | 408 |
| 409 static void drawPatch_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, | 409 static void drawPatch_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, |
| 410 SkGPipeState* state) { | 410 SkGPipeState* state) { |
| 411 | 411 |
| 412 unsigned flags = DrawOp_unpackFlags(op32); | 412 unsigned flags = DrawOp_unpackFlags(op32); |
| 413 | 413 |
| 414 const SkPoint* cubics = skip<SkPoint>(reader, SkPatchUtils::kNumCtrlPts); | 414 const SkPoint* cubics = skip<SkPoint>(reader, SkPatchUtils::kNumCtrlPts); |
| 415 | 415 |
| 416 const SkColor* colors = NULL; | 416 const SkColor* colors = NULL; |
| 417 if (flags & kDrawVertices_HasColors_DrawOpFlag) { | 417 if (flags & kDrawVertices_HasColors_DrawOpFlag) { |
| 418 colors = skip<SkColor>(reader, SkPatchUtils::kNumCorners); | 418 colors = skip<SkColor>(reader, SkPatchUtils::kNumCorners); |
| 419 } | 419 } |
| 420 const SkPoint* texCoords = NULL; | 420 const SkPoint* texCoords = NULL; |
| 421 if (flags & kDrawVertices_HasTexs_DrawOpFlag) { | 421 if (flags & kDrawVertices_HasTexs_DrawOpFlag) { |
| 422 texCoords = skip<SkPoint>(reader, SkPatchUtils::kNumCorners); | 422 texCoords = skip<SkPoint>(reader, SkPatchUtils::kNumCorners); |
| 423 } | 423 } |
| 424 SkAutoTUnref<SkXfermode> xfer; | 424 SkAutoTUnref<SkXfermode> xfer; |
| 425 if (flags & kDrawVertices_HasXfermode_DrawOpFlag) { | 425 if (flags & kDrawVertices_HasXfermode_DrawOpFlag) { |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 644 SkGPipeState* state) { | 644 SkGPipeState* state) { |
| 645 BitmapHolder holder(reader, op32, state); | 645 BitmapHolder holder(reader, op32, state); |
| 646 bool hasPaint = SkToBool(DrawOp_unpackFlags(op32) & kDrawBitmap_HasPaint_Dra wOpFlag); | 646 bool hasPaint = SkToBool(DrawOp_unpackFlags(op32) & kDrawBitmap_HasPaint_Dra wOpFlag); |
| 647 const SkIPoint* point = skip<SkIPoint>(reader); | 647 const SkIPoint* point = skip<SkIPoint>(reader); |
| 648 const SkBitmap* bitmap = holder.getBitmap(); | 648 const SkBitmap* bitmap = holder.getBitmap(); |
| 649 if (state->shouldDraw()) { | 649 if (state->shouldDraw()) { |
| 650 canvas->drawSprite(*bitmap, point->fX, point->fY, hasPaint ? &state->pai nt() : NULL); | 650 canvas->drawSprite(*bitmap, point->fX, point->fY, hasPaint ? &state->pai nt() : NULL); |
| 651 } | 651 } |
| 652 } | 652 } |
| 653 | 653 |
| 654 static void drawImage_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, | |
| 655 SkGPipeState* state) { | |
| 656 bool hasPaint = SkToBool(DrawOp_unpackFlags(op32) & kDrawBitmap_HasPaint_Dra wOpFlag); | |
| 657 SkAutoTUnref<const SkImage> image (static_cast<const SkImage*>(reader->readP tr())); | |
|
reed1
2014/10/01 14:12:39
// Balances call to ref() in SkGPipeWrite
Rémi Piotaix
2014/10/01 19:29:58
Done.
| |
| 658 SkScalar left = reader->readScalar(); | |
| 659 SkScalar top = reader->readScalar(); | |
| 660 | |
| 661 if (state->shouldDraw()) { | |
| 662 canvas->drawImage(image, left, top, hasPaint ? &state->paint() : NULL); | |
| 663 } | |
| 664 } | |
| 665 | |
| 666 static void drawImageRect_rp(SkCanvas* canvas, SkReader32* reader, | |
| 667 uint32_t op32, SkGPipeState* state) { | |
| 668 unsigned flags = DrawOp_unpackFlags(op32); | |
| 669 bool hasPaint = SkToBool(flags & kDrawBitmap_HasPaint_DrawOpFlag); | |
| 670 bool hasSrc = SkToBool(flags & kDrawBitmap_HasSrcRect_DrawOpFlag); | |
| 671 SkAutoTUnref<const SkImage> image (static_cast<const SkImage*>(reader->readP tr())); | |
|
reed1
2014/10/01 14:12:39
// Balances call to ref() in SkGPipeWrite
Rémi Piotaix
2014/10/01 19:29:58
Done.
| |
| 672 | |
| 673 const SkRect* src; | |
| 674 if (hasSrc) { | |
| 675 src = skip<SkRect>(reader); | |
| 676 } else { | |
| 677 src = NULL; | |
| 678 } | |
| 679 const SkRect* dst = skip<SkRect>(reader); | |
| 680 if (state->shouldDraw()) { | |
| 681 canvas->drawImageRect(image, src, *dst, hasPaint ? &state->paint() : NUL L); | |
| 682 } | |
| 683 } | |
| 684 | |
| 654 /////////////////////////////////////////////////////////////////////////////// | 685 /////////////////////////////////////////////////////////////////////////////// |
| 655 | 686 |
| 656 static void drawData_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, | 687 static void drawData_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, |
| 657 SkGPipeState* state) { | 688 SkGPipeState* state) { |
| 658 // since we don't have a paint, we can use data for our (small) sizes | 689 // since we don't have a paint, we can use data for our (small) sizes |
| 659 size_t size = DrawOp_unpackData(op32); | 690 size_t size = DrawOp_unpackData(op32); |
| 660 if (0 == size) { | 691 if (0 == size) { |
| 661 size = reader->readU32(); | 692 size = reader->readU32(); |
| 662 } | 693 } |
| 663 const void* data = reader->skip(SkAlign4(size)); | 694 const void* data = reader->skip(SkAlign4(size)); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 824 clipRect_rp, | 855 clipRect_rp, |
| 825 clipRRect_rp, | 856 clipRRect_rp, |
| 826 concat_rp, | 857 concat_rp, |
| 827 drawBitmap_rp, | 858 drawBitmap_rp, |
| 828 drawBitmapMatrix_rp, | 859 drawBitmapMatrix_rp, |
| 829 drawBitmapNine_rp, | 860 drawBitmapNine_rp, |
| 830 drawBitmapRect_rp, | 861 drawBitmapRect_rp, |
| 831 drawClear_rp, | 862 drawClear_rp, |
| 832 drawData_rp, | 863 drawData_rp, |
| 833 drawDRRect_rp, | 864 drawDRRect_rp, |
| 865 drawImage_rp, | |
| 866 drawImageRect_rp, | |
| 834 drawOval_rp, | 867 drawOval_rp, |
| 835 drawPaint_rp, | 868 drawPaint_rp, |
| 836 drawPatch_rp, | 869 drawPatch_rp, |
| 837 drawPath_rp, | 870 drawPath_rp, |
| 838 drawPicture_rp, | 871 drawPicture_rp, |
| 839 drawPoints_rp, | 872 drawPoints_rp, |
| 840 drawPosText_rp, | 873 drawPosText_rp, |
| 841 drawPosTextH_rp, | 874 drawPosTextH_rp, |
| 842 drawRect_rp, | 875 drawRect_rp, |
| 843 drawRRect_rp, | 876 drawRRect_rp, |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 957 status = kReadAtom_Status; | 990 status = kReadAtom_Status; |
| 958 break; | 991 break; |
| 959 } | 992 } |
| 960 } | 993 } |
| 961 | 994 |
| 962 if (bytesRead) { | 995 if (bytesRead) { |
| 963 *bytesRead = reader.offset(); | 996 *bytesRead = reader.offset(); |
| 964 } | 997 } |
| 965 return status; | 998 return status; |
| 966 } | 999 } |
| OLD | NEW |