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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 SkRRect outer, inner; | 399 SkRRect outer, inner; |
400 reader->readRRect(&outer); | 400 reader->readRRect(&outer); |
401 reader->readRRect(&inner); | 401 reader->readRRect(&inner); |
402 if (state->shouldDraw()) { | 402 if (state->shouldDraw()) { |
403 canvas->drawDRRect(outer, inner, state->paint()); | 403 canvas->drawDRRect(outer, inner, state->paint()); |
404 } | 404 } |
405 } | 405 } |
406 | 406 |
407 static void drawPatch_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, | 407 static void drawPatch_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, |
408 SkGPipeState* state) { | 408 SkGPipeState* state) { |
409 SkPatch patch; | 409 |
410 reader->readPatch(&patch); | 410 unsigned flags = DrawOp_unpackFlags(op32); |
| 411 |
| 412 const SkPoint* cubics = skip<SkPoint>(reader, SkPatch::kNumCtrlPts); |
| 413 |
| 414 const SkColor* colors = NULL; |
| 415 if (flags & kDrawVertices_HasColors_DrawOpFlag) { |
| 416 colors = skip<SkColor>(reader, SkPatch::kNumCorners); |
| 417 } |
| 418 const SkPoint* texCoords = NULL; |
| 419 if (flags & kDrawVertices_HasTexs_DrawOpFlag) { |
| 420 texCoords = skip<SkPoint>(reader, SkPatch::kNumCorners); |
| 421 } |
| 422 SkAutoTUnref<SkXfermode> xfer; |
| 423 if (flags & kDrawVertices_HasXfermode_DrawOpFlag) { |
| 424 int mode = reader->readInt(); |
| 425 if (mode < 0 || mode > SkXfermode::kLastMode) { |
| 426 mode = SkXfermode::kModulate_Mode; |
| 427 } |
| 428 xfer.reset(SkXfermode::Create((SkXfermode::Mode)mode)); |
| 429 } |
411 if (state->shouldDraw()) { | 430 if (state->shouldDraw()) { |
412 canvas->drawPatch(patch, state->paint()); | 431 canvas->drawPatch(cubics, colors, texCoords, xfer, state->paint()); |
413 } | 432 } |
414 } | 433 } |
415 | 434 |
416 static void drawPath_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, | 435 static void drawPath_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, |
417 SkGPipeState* state) { | 436 SkGPipeState* state) { |
418 SkPath path; | 437 SkPath path; |
419 reader->readPath(&path); | 438 reader->readPath(&path); |
420 if (state->shouldDraw()) { | 439 if (state->shouldDraw()) { |
421 canvas->drawPath(path, state->paint()); | 440 canvas->drawPath(path, state->paint()); |
422 } | 441 } |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 status = kReadAtom_Status; | 926 status = kReadAtom_Status; |
908 break; | 927 break; |
909 } | 928 } |
910 } | 929 } |
911 | 930 |
912 if (bytesRead) { | 931 if (bytesRead) { |
913 *bytesRead = reader.offset(); | 932 *bytesRead = reader.offset(); |
914 } | 933 } |
915 return status; | 934 return status; |
916 } | 935 } |
OLD | NEW |