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

Side by Side Diff: Source/core/platform/graphics/GraphicsContext.cpp

Issue 19705006: Use SkImage as a backing store for copying 2d Contexts to ImageBitmaps. Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 21 matching lines...) Expand all
32 #include "core/platform/graphics/ImageBuffer.h" 32 #include "core/platform/graphics/ImageBuffer.h"
33 #include "core/platform/graphics/IntRect.h" 33 #include "core/platform/graphics/IntRect.h"
34 #include "core/platform/graphics/RoundedRect.h" 34 #include "core/platform/graphics/RoundedRect.h"
35 #include "core/platform/graphics/TextRunIterator.h" 35 #include "core/platform/graphics/TextRunIterator.h"
36 #include "core/platform/graphics/skia/SkiaUtils.h" 36 #include "core/platform/graphics/skia/SkiaUtils.h"
37 #include "core/platform/text/BidiResolver.h" 37 #include "core/platform/text/BidiResolver.h"
38 #include "third_party/skia/include/core/SkAnnotation.h" 38 #include "third_party/skia/include/core/SkAnnotation.h"
39 #include "third_party/skia/include/core/SkColorFilter.h" 39 #include "third_party/skia/include/core/SkColorFilter.h"
40 #include "third_party/skia/include/core/SkData.h" 40 #include "third_party/skia/include/core/SkData.h"
41 #include "third_party/skia/include/core/SkDevice.h" 41 #include "third_party/skia/include/core/SkDevice.h"
42 #include "third_party/skia/include/core/SkImage.h"
42 #include "third_party/skia/include/core/SkRRect.h" 43 #include "third_party/skia/include/core/SkRRect.h"
43 #include "third_party/skia/include/core/SkRefCnt.h" 44 #include "third_party/skia/include/core/SkRefCnt.h"
44 #include "third_party/skia/include/effects/SkBlurMaskFilter.h" 45 #include "third_party/skia/include/effects/SkBlurMaskFilter.h"
45 #include "third_party/skia/include/effects/SkCornerPathEffect.h" 46 #include "third_party/skia/include/effects/SkCornerPathEffect.h"
46 #include "weborigin/KURL.h" 47 #include "weborigin/KURL.h"
47 #include "wtf/Assertions.h" 48 #include "wtf/Assertions.h"
48 #include "wtf/MathExtras.h" 49 #include "wtf/MathExtras.h"
49 50
50 #if OS(DARWIN) 51 #if OS(DARWIN)
51 #include <ApplicationServices/ApplicationServices.h> 52 #include <ApplicationServices/ApplicationServices.h>
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 previousInterpolationQuality = imageInterpolationQuality(); 1011 previousInterpolationQuality = imageInterpolationQuality();
1011 setImageInterpolationQuality(InterpolationLow); 1012 setImageInterpolationQuality(InterpolationLow);
1012 } 1013 }
1013 1014
1014 image->draw(this, dest, src, op, blendMode, shouldRespectImageOrientation); 1015 image->draw(this, dest, src, op, blendMode, shouldRespectImageOrientation);
1015 1016
1016 if (useLowQualityScale) 1017 if (useLowQualityScale)
1017 setImageInterpolationQuality(previousInterpolationQuality); 1018 setImageInterpolationQuality(previousInterpolationQuality);
1018 } 1019 }
1019 1020
1021 void GraphicsContext::drawImage(SkImage* image, const FloatRect& dest, const Flo atRect& src, CompositeOperator op, BlendMode blendMode, bool useLowQualityScale)
1022 {
1023 if (paintingDisabled() || !image)
1024 return;
1025
1026 InterpolationQuality previousInterpolationQuality = InterpolationDefault;
1027
1028 if (useLowQualityScale) {
1029 previousInterpolationQuality = imageInterpolationQuality();
1030 setImageInterpolationQuality(InterpolationLow);
1031 }
1032
1033 image->draw(canvas(), dest, src, 0);
1034
1035 if (useLowQualityScale)
1036 setImageInterpolationQuality(previousInterpolationQuality);
1037 }
1038
1020 void GraphicsContext::drawTiledImage(Image* image, const IntRect& destRect, cons t IntPoint& srcPoint, const IntSize& tileSize, CompositeOperator op, bool useLow QualityScale, BlendMode blendMode) 1039 void GraphicsContext::drawTiledImage(Image* image, const IntRect& destRect, cons t IntPoint& srcPoint, const IntSize& tileSize, CompositeOperator op, bool useLow QualityScale, BlendMode blendMode)
1021 { 1040 {
1022 if (paintingDisabled() || !image) 1041 if (paintingDisabled() || !image)
1023 return; 1042 return;
1024 1043
1025 if (useLowQualityScale) { 1044 if (useLowQualityScale) {
1026 InterpolationQuality previousInterpolationQuality = imageInterpolationQu ality(); 1045 InterpolationQuality previousInterpolationQuality = imageInterpolationQu ality();
1027 setImageInterpolationQuality(InterpolationLow); 1046 setImageInterpolationQuality(InterpolationLow);
1028 image->drawTiled(this, destRect, srcPoint, tileSize, op, blendMode); 1047 image->drawTiled(this, destRect, srcPoint, tileSize, op, blendMode);
1029 setImageInterpolationQuality(previousInterpolationQuality); 1048 setImageInterpolationQuality(previousInterpolationQuality);
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
1895 1914
1896 void GraphicsContext::didDrawTextInRect(const SkRect& textRect) 1915 void GraphicsContext::didDrawTextInRect(const SkRect& textRect)
1897 { 1916 {
1898 if (m_trackTextRegion) { 1917 if (m_trackTextRegion) {
1899 TRACE_EVENT0("skia", "PlatformContextSkia::trackTextRegion"); 1918 TRACE_EVENT0("skia", "PlatformContextSkia::trackTextRegion");
1900 m_textRegion.join(textRect); 1919 m_textRegion.join(textRect);
1901 } 1920 }
1902 } 1921 }
1903 1922
1904 } 1923 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698