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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/BitmapImage.h

Issue 2530443004: Add target color profile to BitmapImage::draw (Closed)
Patch Set: Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/BitmapImage.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 (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 * Copyright (C) 2008-2009 Torch Mobile, Inc. 4 * Copyright (C) 2008-2009 Torch Mobile, Inc.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 BitmapImage(const SkBitmap&, ImageObserver* = 0); 110 BitmapImage(const SkBitmap&, ImageObserver* = 0);
111 BitmapImage(ImageObserver* = 0); 111 BitmapImage(ImageObserver* = 0);
112 112
113 void draw(SkCanvas*, 113 void draw(SkCanvas*,
114 const SkPaint&, 114 const SkPaint&,
115 const FloatRect& dstRect, 115 const FloatRect& dstRect,
116 const FloatRect& srcRect, 116 const FloatRect& srcRect,
117 RespectImageOrientationEnum, 117 RespectImageOrientationEnum,
118 ImageClampingMode) override; 118 ImageClampingMode) override;
119 119
120 void drawInColorSpace(SkCanvas*,
121 const SkPaint&,
122 const FloatRect& dstRect,
123 const FloatRect& srcRect,
124 RespectImageOrientationEnum,
125 ImageClampingMode,
126 sk_sp<SkColorSpace>) override;
127
120 size_t currentFrame() const { return m_currentFrame; } 128 size_t currentFrame() const { return m_currentFrame; }
121 size_t frameCount(); 129 size_t frameCount();
122 130
123 sk_sp<SkImage> frameAtIndex(size_t); 131 sk_sp<SkImage> frameAtIndex(size_t, sk_sp<SkColorSpace> = nullptr);
124 132
125 bool frameIsCompleteAtIndex(size_t) const; 133 bool frameIsCompleteAtIndex(size_t) const;
126 float frameDurationAtIndex(size_t) const; 134 float frameDurationAtIndex(size_t) const;
127 bool frameHasAlphaAtIndex(size_t); 135 bool frameHasAlphaAtIndex(size_t);
128 ImageOrientation frameOrientationAtIndex(size_t); 136 ImageOrientation frameOrientationAtIndex(size_t);
129 137
130 sk_sp<SkImage> decodeAndCacheFrame(size_t index); 138 sk_sp<SkImage> decodeAndCacheFrame(size_t index, sk_sp<SkColorSpace>);
131 void updateSize() const; 139 void updateSize() const;
132 140
133 // Returns the total number of bytes allocated for all framebuffers, i.e. 141 // Returns the total number of bytes allocated for all framebuffers, i.e.
134 // the sum of m_source.frameBytesAtIndex(...) for all frames. 142 // the sum of m_source.frameBytesAtIndex(...) for all frames.
135 size_t totalFrameBytes(); 143 size_t totalFrameBytes();
136 144
137 // Called to wipe out the entire frame buffer cache and tell the image 145 // Called to wipe out the entire frame buffer cache and tell the image
138 // source to destroy everything; this is used when e.g. we want to free 146 // source to destroy everything; this is used when e.g. we want to free
139 // some room in the image cache. 147 // some room in the image cache.
140 void destroyDecodedData() override; 148 void destroyDecodedData() override;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 mutable IntSize m_sizeRespectingOrientation; 192 mutable IntSize m_sizeRespectingOrientation;
185 193
186 size_t m_currentFrame; // The index of the current frame of animation. 194 size_t m_currentFrame; // The index of the current frame of animation.
187 Vector<FrameData, 1> m_frames; // An array of the cached frames of the 195 Vector<FrameData, 1> m_frames; // An array of the cached frames of the
188 // animation. We have to ref frames to pin 196 // animation. We have to ref frames to pin
189 // them in the cache. 197 // them in the cache.
190 198
191 sk_sp<SkImage> 199 sk_sp<SkImage>
192 m_cachedFrame; // A cached copy of the most recently-accessed frame. 200 m_cachedFrame; // A cached copy of the most recently-accessed frame.
193 size_t m_cachedFrameIndex; // Index of the frame that is cached. 201 size_t m_cachedFrameIndex; // Index of the frame that is cached.
202 sk_sp<SkColorSpace>
203 m_cachedFrameColorSpace; // Color space of the cached frame.
194 204
195 std::unique_ptr<Timer<BitmapImage>> m_frameTimer; 205 std::unique_ptr<Timer<BitmapImage>> m_frameTimer;
196 int m_repetitionCount; // How many total animation loops we should do. This 206 int m_repetitionCount; // How many total animation loops we should do. This
197 // will be cAnimationNone if this image type is 207 // will be cAnimationNone if this image type is
198 // incapable of animation. 208 // incapable of animation.
199 RepetitionCountStatus m_repetitionCountStatus; 209 RepetitionCountStatus m_repetitionCountStatus;
200 int m_repetitionsComplete; // How many repetitions we've finished. 210 int m_repetitionsComplete; // How many repetitions we've finished.
201 double m_desiredFrameStartTime; // The system time at which we hope to see 211 double m_desiredFrameStartTime; // The system time at which we hope to see
202 // the next call to startAnimation(). 212 // the next call to startAnimation().
203 213
(...skipping 11 matching lines...) Expand all
215 bool m_sizeAvailable : 1; // Whether we can obtain the size of the first 225 bool m_sizeAvailable : 1; // Whether we can obtain the size of the first
216 // image frame from ImageIO yet. 226 // image frame from ImageIO yet.
217 mutable bool m_haveFrameCount : 1; 227 mutable bool m_haveFrameCount : 1;
218 }; 228 };
219 229
220 DEFINE_IMAGE_TYPE_CASTS(BitmapImage); 230 DEFINE_IMAGE_TYPE_CASTS(BitmapImage);
221 231
222 } // namespace blink 232 } // namespace blink
223 233
224 #endif 234 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/BitmapImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698