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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/Image.cpp

Issue 1309393007: [poc] redecode Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: resetColorProfileForTesting rename Created 5 years 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 (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, 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 19 matching lines...) Expand all
30 #include "platform/Length.h" 30 #include "platform/Length.h"
31 #include "platform/MIMETypeRegistry.h" 31 #include "platform/MIMETypeRegistry.h"
32 #include "platform/PlatformInstrumentation.h" 32 #include "platform/PlatformInstrumentation.h"
33 #include "platform/RuntimeEnabledFeatures.h" 33 #include "platform/RuntimeEnabledFeatures.h"
34 #include "platform/SharedBuffer.h" 34 #include "platform/SharedBuffer.h"
35 #include "platform/TraceEvent.h" 35 #include "platform/TraceEvent.h"
36 #include "platform/geometry/FloatPoint.h" 36 #include "platform/geometry/FloatPoint.h"
37 #include "platform/geometry/FloatRect.h" 37 #include "platform/geometry/FloatRect.h"
38 #include "platform/geometry/FloatSize.h" 38 #include "platform/geometry/FloatSize.h"
39 #include "platform/graphics/BitmapImage.h" 39 #include "platform/graphics/BitmapImage.h"
40 #include "platform/graphics/ColorSpaceProfile.h"
40 #include "platform/graphics/DeferredImageDecoder.h" 41 #include "platform/graphics/DeferredImageDecoder.h"
41 #include "platform/graphics/GraphicsContext.h" 42 #include "platform/graphics/GraphicsContext.h"
43 #include "platform/graphics/GraphicsScreen.h"
42 #include "public/platform/Platform.h" 44 #include "public/platform/Platform.h"
43 #include "public/platform/WebData.h" 45 #include "public/platform/WebData.h"
44 #include "third_party/skia/include/core/SkCanvas.h" 46 #include "third_party/skia/include/core/SkCanvas.h"
45 #include "third_party/skia/include/core/SkImage.h" 47 #include "third_party/skia/include/core/SkImage.h"
46 #include "third_party/skia/include/core/SkPictureRecorder.h" 48 #include "third_party/skia/include/core/SkPictureRecorder.h"
47 #include "wtf/MainThread.h" 49 #include "wtf/MainThread.h"
48 #include "wtf/StdLibExtras.h" 50 #include "wtf/StdLibExtras.h"
49 51
50 #include <math.h> 52 #include <math.h>
51 53
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 picture.get(), SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, & shaderMatrix, nullptr)); 209 picture.get(), SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, & shaderMatrix, nullptr));
208 } 210 }
209 211
210 } // anonymous namespace 212 } // anonymous namespace
211 213
212 void Image::drawPattern(GraphicsContext* context, const FloatRect& floatSrcRect, const FloatSize& scale, 214 void Image::drawPattern(GraphicsContext* context, const FloatRect& floatSrcRect, const FloatSize& scale,
213 const FloatPoint& phase, SkXfermode::Mode compositeOp, const FloatRect& dest Rect, const IntSize& repeatSpacing) 215 const FloatPoint& phase, SkXfermode::Mode compositeOp, const FloatRect& dest Rect, const IntSize& repeatSpacing)
214 { 216 {
215 TRACE_EVENT0("skia", "Image::drawPattern"); 217 TRACE_EVENT0("skia", "Image::drawPattern");
216 218
219 if (imageColorProfilesEnabled() && isBitmapImage() && toBitmapImage(this)->h asColorProfile())
220 toBitmapImage(this)->notifyDeviceProfile(screenColorProfile(currentScree nId()).get());
221
217 RefPtr<SkImage> image = imageForCurrentFrame(); 222 RefPtr<SkImage> image = imageForCurrentFrame();
218 if (!image) 223 if (!image)
219 return; 224 return;
220 225
221 FloatRect normSrcRect = floatSrcRect; 226 FloatRect normSrcRect = floatSrcRect;
222 227
223 normSrcRect.intersect(FloatRect(0, 0, image->width(), image->height())); 228 normSrcRect.intersect(FloatRect(0, 0, image->width(), image->height()));
224 if (destRect.isEmpty() || normSrcRect.isEmpty()) 229 if (destRect.isEmpty() || normSrcRect.isEmpty())
225 return; // nothing to draw 230 return; // nothing to draw
226 231
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 278
274 return image.release(); 279 return image.release();
275 } 280 }
276 281
277 bool Image::isTextureBacked() 282 bool Image::isTextureBacked()
278 { 283 {
279 return imageForCurrentFrame()->isTextureBacked(); 284 return imageForCurrentFrame()->isTextureBacked();
280 } 285 }
281 286
282 } // namespace blink 287 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698