Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/pipe/SkGPipeRead.cpp

Issue 463493002: SkCanvas::drawPatch param SkPoint[12] (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Removed GPU headers from GM Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkValidatingReadBuffer.cpp ('k') | src/pipe/SkGPipeWrite.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 #include "SkPaint.h" 12 #include "SkPaint.h"
13 #include "SkGPipe.h" 13 #include "SkGPipe.h"
14 #include "SkGPipePriv.h" 14 #include "SkGPipePriv.h"
15 #include "SkReader32.h" 15 #include "SkReader32.h"
16 #include "SkStream.h" 16 #include "SkStream.h"
17 17
18 #include "SkAnnotation.h" 18 #include "SkAnnotation.h"
19 #include "SkColorFilter.h" 19 #include "SkColorFilter.h"
20 #include "SkDrawLooper.h" 20 #include "SkDrawLooper.h"
21 #include "SkImageFilter.h" 21 #include "SkImageFilter.h"
22 #include "SkMaskFilter.h" 22 #include "SkMaskFilter.h"
23 #include "SkReadBuffer.h" 23 #include "SkReadBuffer.h"
24 #include "SkPatchUtils.h"
24 #include "SkPathEffect.h" 25 #include "SkPathEffect.h"
25 #include "SkRasterizer.h" 26 #include "SkRasterizer.h"
26 #include "SkRRect.h" 27 #include "SkRRect.h"
27 #include "SkShader.h" 28 #include "SkShader.h"
28 #include "SkTypeface.h" 29 #include "SkTypeface.h"
29 #include "SkXfermode.h" 30 #include "SkXfermode.h"
30 31
31 static SkFlattenable::Type paintflat_to_flattype(PaintFlats pf) { 32 static SkFlattenable::Type paintflat_to_flattype(PaintFlats pf) {
32 static const uint8_t gEffectTypesInPaintFlatsOrder[] = { 33 static const uint8_t gEffectTypesInPaintFlatsOrder[] = {
33 SkFlattenable::kSkColorFilter_Type, 34 SkFlattenable::kSkColorFilter_Type,
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 SkRRect outer, inner; 400 SkRRect outer, inner;
400 reader->readRRect(&outer); 401 reader->readRRect(&outer);
401 reader->readRRect(&inner); 402 reader->readRRect(&inner);
402 if (state->shouldDraw()) { 403 if (state->shouldDraw()) {
403 canvas->drawDRRect(outer, inner, state->paint()); 404 canvas->drawDRRect(outer, inner, state->paint());
404 } 405 }
405 } 406 }
406 407
407 static void drawPatch_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, 408 static void drawPatch_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
408 SkGPipeState* state) { 409 SkGPipeState* state) {
409 SkPatch patch; 410
410 reader->readPatch(&patch); 411 unsigned flags = DrawOp_unpackFlags(op32);
412
413 const SkPoint* cubics = skip<SkPoint>(reader, SkPatchUtils::kNumCtrlPts);
414
415 const SkColor* colors = NULL;
416 if (flags & kDrawVertices_HasColors_DrawOpFlag) {
417 colors = skip<SkColor>(reader, SkPatchUtils::kNumCorners);
418 }
419 const SkPoint* texCoords = NULL;
420 if (flags & kDrawVertices_HasTexs_DrawOpFlag) {
421 texCoords = skip<SkPoint>(reader, SkPatchUtils::kNumCorners);
422 }
423 SkAutoTUnref<SkXfermode> xfer;
424 if (flags & kDrawVertices_HasXfermode_DrawOpFlag) {
425 int mode = reader->readInt();
426 if (mode < 0 || mode > SkXfermode::kLastMode) {
427 mode = SkXfermode::kModulate_Mode;
428 }
429 xfer.reset(SkXfermode::Create((SkXfermode::Mode)mode));
430 }
411 if (state->shouldDraw()) { 431 if (state->shouldDraw()) {
412 canvas->drawPatch(patch, state->paint()); 432 canvas->drawPatch(cubics, colors, texCoords, xfer, state->paint());
413 } 433 }
414 } 434 }
415 435
416 static void drawPath_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, 436 static void drawPath_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
417 SkGPipeState* state) { 437 SkGPipeState* state) {
418 SkPath path; 438 SkPath path;
419 reader->readPath(&path); 439 reader->readPath(&path);
420 if (state->shouldDraw()) { 440 if (state->shouldDraw()) {
421 canvas->drawPath(path, state->paint()); 441 canvas->drawPath(path, state->paint());
422 } 442 }
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 status = kReadAtom_Status; 927 status = kReadAtom_Status;
908 break; 928 break;
909 } 929 }
910 } 930 }
911 931
912 if (bytesRead) { 932 if (bytesRead) {
913 *bytesRead = reader.offset(); 933 *bytesRead = reader.offset();
914 } 934 }
915 return status; 935 return status;
916 } 936 }
OLDNEW
« no previous file with comments | « src/core/SkValidatingReadBuffer.cpp ('k') | src/pipe/SkGPipeWrite.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698