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 #include "SkAnnotation.h" | 9 #include "SkAnnotation.h" |
10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 } | 1028 } |
1029 } | 1029 } |
1030 | 1030 |
1031 void SkGPipeCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4
], | 1031 void SkGPipeCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4
], |
1032 const SkPoint texCoords[4], SkXfermode* xmode, | 1032 const SkPoint texCoords[4], SkXfermode* xmode, |
1033 const SkPaint& paint) { | 1033 const SkPaint& paint) { |
1034 NOTIFY_SETUP(this); | 1034 NOTIFY_SETUP(this); |
1035 | 1035 |
1036 size_t size = SkPatchUtils::kNumCtrlPts * sizeof(SkPoint); | 1036 size_t size = SkPatchUtils::kNumCtrlPts * sizeof(SkPoint); |
1037 unsigned flags = 0; | 1037 unsigned flags = 0; |
1038 if (NULL != colors) { | 1038 if (colors) { |
1039 flags |= kDrawVertices_HasColors_DrawOpFlag; | 1039 flags |= kDrawVertices_HasColors_DrawOpFlag; |
1040 size += SkPatchUtils::kNumCorners * sizeof(SkColor); | 1040 size += SkPatchUtils::kNumCorners * sizeof(SkColor); |
1041 } | 1041 } |
1042 if (NULL != texCoords) { | 1042 if (texCoords) { |
1043 flags |= kDrawVertices_HasTexs_DrawOpFlag; | 1043 flags |= kDrawVertices_HasTexs_DrawOpFlag; |
1044 size += SkPatchUtils::kNumCorners * sizeof(SkPoint); | 1044 size += SkPatchUtils::kNumCorners * sizeof(SkPoint); |
1045 } | 1045 } |
1046 if (NULL != xmode) { | 1046 if (xmode) { |
1047 SkXfermode::Mode mode; | 1047 SkXfermode::Mode mode; |
1048 if (xmode->asMode(&mode) && SkXfermode::kModulate_Mode != mode) { | 1048 if (xmode->asMode(&mode) && SkXfermode::kModulate_Mode != mode) { |
1049 flags |= kDrawVertices_HasXfermode_DrawOpFlag; | 1049 flags |= kDrawVertices_HasXfermode_DrawOpFlag; |
1050 size += sizeof(int32_t); | 1050 size += sizeof(int32_t); |
1051 } | 1051 } |
1052 } | 1052 } |
1053 | 1053 |
1054 this->writePaint(paint); | 1054 this->writePaint(paint); |
1055 if (this->needOpBytes(size)) { | 1055 if (this->needOpBytes(size)) { |
1056 this->writeOp(kDrawPatch_DrawOp, flags, 0); | 1056 this->writeOp(kDrawPatch_DrawOp, flags, 0); |
1057 | 1057 |
1058 fWriter.write(cubics, SkPatchUtils::kNumCtrlPts * sizeof(SkPoint)); | 1058 fWriter.write(cubics, SkPatchUtils::kNumCtrlPts * sizeof(SkPoint)); |
1059 | 1059 |
1060 if (NULL != colors) { | 1060 if (colors) { |
1061 fWriter.write(colors, SkPatchUtils::kNumCorners * sizeof(SkColor)); | 1061 fWriter.write(colors, SkPatchUtils::kNumCorners * sizeof(SkColor)); |
1062 } | 1062 } |
1063 | 1063 |
1064 if (NULL != texCoords) { | 1064 if (texCoords) { |
1065 fWriter.write(texCoords, SkPatchUtils::kNumCorners * sizeof(SkPoint)
); | 1065 fWriter.write(texCoords, SkPatchUtils::kNumCorners * sizeof(SkPoint)
); |
1066 } | 1066 } |
1067 | 1067 |
1068 if (flags & kDrawVertices_HasXfermode_DrawOpFlag) { | 1068 if (flags & kDrawVertices_HasXfermode_DrawOpFlag) { |
1069 SkXfermode::Mode mode = SkXfermode::kModulate_Mode; | 1069 SkXfermode::Mode mode = SkXfermode::kModulate_Mode; |
1070 SkAssertResult(xmode->asMode(&mode)); | 1070 SkAssertResult(xmode->asMode(&mode)); |
1071 fWriter.write32(mode); | 1071 fWriter.write32(mode); |
1072 } | 1072 } |
1073 } | 1073 } |
1074 } | 1074 } |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 return fCanvas->shuttleBitmap(bitmap, slot); | 1336 return fCanvas->shuttleBitmap(bitmap, slot); |
1337 } | 1337 } |
1338 | 1338 |
1339 void BitmapShuttle::removeCanvas() { | 1339 void BitmapShuttle::removeCanvas() { |
1340 if (NULL == fCanvas) { | 1340 if (NULL == fCanvas) { |
1341 return; | 1341 return; |
1342 } | 1342 } |
1343 fCanvas->unref(); | 1343 fCanvas->unref(); |
1344 fCanvas = NULL; | 1344 fCanvas = NULL; |
1345 } | 1345 } |
OLD | NEW |