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

Side by Side Diff: src/core/SkBitmapDevice.cpp

Issue 424663006: SkCanvas interface for drawing a patch. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkConfig8888.h" 9 #include "SkConfig8888.h"
10 #include "SkDraw.h" 10 #include "SkDraw.h"
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 void SkBitmapDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode , 336 void SkBitmapDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode ,
337 int vertexCount, 337 int vertexCount,
338 const SkPoint verts[], const SkPoint textures[ ], 338 const SkPoint verts[], const SkPoint textures[ ],
339 const SkColor colors[], SkXfermode* xmode, 339 const SkColor colors[], SkXfermode* xmode,
340 const uint16_t indices[], int indexCount, 340 const uint16_t indices[], int indexCount,
341 const SkPaint& paint) { 341 const SkPaint& paint) {
342 draw.drawVertices(vmode, vertexCount, verts, textures, colors, xmode, 342 draw.drawVertices(vmode, vertexCount, verts, textures, colors, xmode,
343 indices, indexCount, paint); 343 indices, indexCount, paint);
344 } 344 }
345 345
346 void SkBitmapDevice::drawPatch(const SkDraw& draw, const SkPatch& patch, const S kPaint& paint) {
347 SkPatch::VertexData data;
348 patch.getVertexData(&data, draw.fMatrix->getScaleX() * 10, draw.fMatrix->get ScaleY() * 10);
bsalomon 2014/07/28 20:56:26 I don't think getScaleX and getScaleY are what you
dandov 2014/07/29 18:45:46 I moved this to SkBaseDevice and created a default
349 draw.drawVertices(SkCanvas::kTriangles_VertexMode, data.fVertexCount, data.f Points,
350 data.fTexCoords, data.fColors, NULL, data.fIndices, data.f IndexCount, paint);
351 }
352
346 void SkBitmapDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device, 353 void SkBitmapDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device,
347 int x, int y, const SkPaint& paint) { 354 int x, int y, const SkPaint& paint) {
348 const SkBitmap& src = device->accessBitmap(false); 355 const SkBitmap& src = device->accessBitmap(false);
349 draw.drawSprite(src, x, y, paint); 356 draw.drawSprite(src, x, y, paint);
350 } 357 }
351 358
352 SkSurface* SkBitmapDevice::newSurface(const SkImageInfo& info) { 359 SkSurface* SkBitmapDevice::newSurface(const SkImageInfo& info) {
353 return SkSurface::NewRaster(info); 360 return SkSurface::NewRaster(info);
354 } 361 }
355 362
(...skipping 26 matching lines...) Expand all
382 paint.getStyle() != SkPaint::kFill_Style || 389 paint.getStyle() != SkPaint::kFill_Style ||
383 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { 390 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) {
384 // turn off lcd 391 // turn off lcd
385 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; 392 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag;
386 flags->fHinting = paint.getHinting(); 393 flags->fHinting = paint.getHinting();
387 return true; 394 return true;
388 } 395 }
389 // we're cool with the paint as is 396 // we're cool with the paint as is
390 return false; 397 return false;
391 } 398 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698