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

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

Issue 1686203002: Skia Filter Quality and Scaling Metrics (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: feedback Created 4 years, 8 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/gpu/SkGpuDevice.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 * 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 flags &= ~SkPaint::kLCDRenderText_Flag; 452 flags &= ~SkPaint::kLCDRenderText_Flag;
453 flags |= SkPaint::kGenA8FromLCD_Flag; 453 flags |= SkPaint::kGenA8FromLCD_Flag;
454 } 454 }
455 455
456 return flags; 456 return flags;
457 } 457 }
458 458
459 sk_sp<SkSurface> SkBaseDevice::makeSurface(SkImageInfo const&, SkSurfaceProps co nst&) { 459 sk_sp<SkSurface> SkBaseDevice::makeSurface(SkImageInfo const&, SkSurfaceProps co nst&) {
460 return nullptr; 460 return nullptr;
461 } 461 }
462
463 //////////////////////////////////////////////////////////////////////////////// //////////
464
465 void SkBaseDevice::LogDrawScaleFactor(const SkMatrix& matrix, SkFilterQuality fi lterQuality) {
466 #if SK_HISTOGRAMS_ENABLED
467 enum ScaleFactor {
468 kUpscale_ScaleFactor,
469 kNoScale_ScaleFactor,
470 kDownscale_ScaleFactor,
471 kLargeDownscale_ScaleFactor,
472
473 kLast_ScaleFactor = kLargeDownscale_ScaleFactor
474 };
475
476 float rawScaleFactor = matrix.getMinScale();
477
478 ScaleFactor scaleFactor;
479 if (rawScaleFactor < 0.5f) {
480 scaleFactor = kLargeDownscale_ScaleFactor;
481 } else if (rawScaleFactor < 1.0f) {
482 scaleFactor = kDownscale_ScaleFactor;
483 } else if (rawScaleFactor > 1.0f) {
484 scaleFactor = kUpscale_ScaleFactor;
485 } else {
486 scaleFactor = kNoScale_ScaleFactor;
487 }
488
489 switch (filterQuality) {
490 case kNone_SkFilterQuality:
491 SK_HISTOGRAM_ENUMERATION("DrawScaleFactor.NoneFilterQuality", scaleF actor,
492 kLast_ScaleFactor + 1);
493 break;
494 case kLow_SkFilterQuality:
495 SK_HISTOGRAM_ENUMERATION("DrawScaleFactor.LowFilterQuality", scaleFa ctor,
496 kLast_ScaleFactor + 1);
497 break;
498 case kMedium_SkFilterQuality:
499 SK_HISTOGRAM_ENUMERATION("DrawScaleFactor.MediumFilterQuality", scal eFactor,
500 kLast_ScaleFactor + 1);
501 break;
502 case kHigh_SkFilterQuality:
503 SK_HISTOGRAM_ENUMERATION("DrawScaleFactor.HighFilterQuality", scaleF actor,
504 kLast_ScaleFactor + 1);
505 break;
506 }
507
508 // Also log filter quality independent scale factor.
509 SK_HISTOGRAM_ENUMERATION("DrawScaleFactor.AnyFilterQuality", scaleFactor,
510 kLast_ScaleFactor + 1);
511
512 // Also log an overall histogram of filter quality.
513 SK_HISTOGRAM_ENUMERATION("FilterQuality", filterQuality, kLast_SkFilterQuali ty + 1);
514 #endif
515 }
516
OLDNEW
« no previous file with comments | « src/core/SkBitmapDevice.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698