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

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

Issue 2164763003: remove dead methods now that we use specials exclusively for imagefilters (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove internal_getBM/fromBM Created 4 years, 5 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/SkBitmapDevice.cpp ('k') | src/core/SkSpecialImage.h » ('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 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 "SkColorFilter.h" 8 #include "SkColorFilter.h"
9 #include "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkDraw.h" 10 #include "SkDraw.h"
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 currM.setConcat(*draw.fMatrix, localM); 440 currM.setConcat(*draw.fMatrix, localM);
441 localD.fMatrix = &currM; 441 localD.fMatrix = &currM;
442 int subLen = proc((const char*)text); 442 int subLen = proc((const char*)text);
443 this->drawText(localD, text, subLen, 0, 0, paint); 443 this->drawText(localD, text, subLen, 0, 0, paint);
444 text = (const char*)text + subLen; 444 text = (const char*)text + subLen;
445 } 445 }
446 } 446 }
447 447
448 //////////////////////////////////////////////////////////////////////////////// ////////// 448 //////////////////////////////////////////////////////////////////////////////// //////////
449 449
450 void SkBaseDevice::drawSpriteWithFilter(const SkDraw& draw, const SkBitmap& bitm ap,
451 int x, int y,
452 const SkPaint& paint) {
453 SkImageFilter* filter = paint.getImageFilter();
454 SkASSERT(filter);
455
456 SkIPoint offset = SkIPoint::Make(0, 0);
457 SkMatrix matrix = *draw.fMatrix;
458 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y));
459 const SkIRect clipBounds = draw.fRC->getBounds().makeOffset(-x, -y);
460 SkAutoTUnref<SkImageFilterCache> cache(this->getImageFilterCache());
461 SkImageFilter::Context ctx(matrix, clipBounds, cache.get());
462
463 sk_sp<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(bitmap, &this-> surfaceProps()));
464 if (!srcImg) {
465 return; // something disastrous happened
466 }
467
468 sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg.get(), ctx, &offs et));
469 if (resultImg) {
470 SkPaint tmpUnfiltered(paint);
471 tmpUnfiltered.setImageFilter(nullptr);
472 SkBitmap resultBM;
473 if (resultImg->internal_getBM(&resultBM)) {
474 // TODO: add drawSprite(SkSpecialImage) to SkDevice? (see skbug.com/ 5073)
475 this->drawSprite(draw, resultBM, x + offset.x(), y + offset.y(), tmp Unfiltered);
476 }
477 }
478 }
479
480 uint32_t SkBaseDevice::filterTextFlags(const SkPaint& paint) const { 450 uint32_t SkBaseDevice::filterTextFlags(const SkPaint& paint) const {
481 uint32_t flags = paint.getFlags(); 451 uint32_t flags = paint.getFlags();
482 452
483 if (!paint.isLCDRenderText() || !paint.isAntiAlias()) { 453 if (!paint.isLCDRenderText() || !paint.isAntiAlias()) {
484 return flags; 454 return flags;
485 } 455 }
486 456
487 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry() 457 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry()
488 || this->onShouldDisableLCD(paint)) { 458 || this->onShouldDisableLCD(paint)) {
489 459
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 515
546 // Also log filter quality independent scale factor. 516 // Also log filter quality independent scale factor.
547 SK_HISTOGRAM_ENUMERATION("DrawScaleFactor.AnyFilterQuality", scaleFactor, 517 SK_HISTOGRAM_ENUMERATION("DrawScaleFactor.AnyFilterQuality", scaleFactor,
548 kLast_ScaleFactor + 1); 518 kLast_ScaleFactor + 1);
549 519
550 // Also log an overall histogram of filter quality. 520 // Also log an overall histogram of filter quality.
551 SK_HISTOGRAM_ENUMERATION("FilterQuality", filterQuality, kLast_SkFilterQuali ty + 1); 521 SK_HISTOGRAM_ENUMERATION("FilterQuality", filterQuality, kLast_SkFilterQuali ty + 1);
552 #endif 522 #endif
553 } 523 }
554 524
OLDNEW
« no previous file with comments | « src/core/SkBitmapDevice.cpp ('k') | src/core/SkSpecialImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698