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

Side by Side Diff: Source/core/platform/image-decoders/ImageDecoder.h

Issue 23464095: WTF::notFound looks too much like a local variable. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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) 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 3 * Copyright (C) Research In Motion Limited 2009-2010. 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 // This will always just be the entire buffer except for GIF or WebP 214 // This will always just be the entire buffer except for GIF or WebP
215 // frames whose original rect was smaller than the overall image size. 215 // frames whose original rect was smaller than the overall image size.
216 IntRect m_originalFrameRect; 216 IntRect m_originalFrameRect;
217 Status m_status; 217 Status m_status;
218 unsigned m_duration; 218 unsigned m_duration;
219 DisposalMethod m_disposalMethod; 219 DisposalMethod m_disposalMethod;
220 AlphaBlendSource m_alphaBlendSource; 220 AlphaBlendSource m_alphaBlendSource;
221 bool m_premultiplyAlpha; 221 bool m_premultiplyAlpha;
222 222
223 // The frame that must be decoded before this frame can be decoded. 223 // The frame that must be decoded before this frame can be decoded.
224 // WTF::notFound if this frame doesn't require any previous frame. 224 // WTF::kNotFound if this frame doesn't require any previous frame.
225 // This is used by ImageDecoder::clearCacheExceptFrame(), and will never 225 // This is used by ImageDecoder::clearCacheExceptFrame(), and will never
226 // be read for image formats that do not have multiple frames. 226 // be read for image formats that do not have multiple frames.
227 size_t m_requiredPreviousFrameIndex; 227 size_t m_requiredPreviousFrameIndex;
228 #if !ASSERT_DISABLED 228 #if !ASSERT_DISABLED
229 bool m_requiredPreviousFrameIndexValid; 229 bool m_requiredPreviousFrameIndexValid;
230 #endif 230 #endif
231 }; 231 };
232 232
233 // ImageDecoder is a base for all format-specific decoders 233 // ImageDecoder is a base for all format-specific decoders
234 // (e.g. JPEGImageDecoder). This base manages the ImageFrame cache. 234 // (e.g. JPEGImageDecoder). This base manages the ImageFrame cache.
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 // clean up any local data. 391 // clean up any local data.
392 virtual bool setFailed() 392 virtual bool setFailed()
393 { 393 {
394 m_failed = true; 394 m_failed = true;
395 return false; 395 return false;
396 } 396 }
397 397
398 bool failed() const { return m_failed; } 398 bool failed() const { return m_failed; }
399 399
400 // Clears decoded pixel data from all frames except the provided frame. 400 // Clears decoded pixel data from all frames except the provided frame.
401 // Callers may pass WTF::notFound to clear all frames. 401 // Callers may pass WTF::kNotFound to clear all frames.
402 // Note: If |m_frameBufferCache| contains only one frame, it won't be cl eared. 402 // Note: If |m_frameBufferCache| contains only one frame, it won't be cl eared.
403 // Returns the number of bytes of frame data actually cleared. 403 // Returns the number of bytes of frame data actually cleared.
404 virtual size_t clearCacheExceptFrame(size_t); 404 virtual size_t clearCacheExceptFrame(size_t);
405 405
406 // If the image has a cursor hot-spot, stores it in the argument 406 // If the image has a cursor hot-spot, stores it in the argument
407 // and returns true. Otherwise returns false. 407 // and returns true. Otherwise returns false.
408 virtual bool hotSpot(IntPoint&) const { return false; } 408 virtual bool hotSpot(IntPoint&) const { return false; }
409 409
410 virtual void setMemoryAllocator(SkBitmap::Allocator* allocator) 410 virtual void setMemoryAllocator(SkBitmap::Allocator* allocator)
411 { 411 {
412 // FIXME: this doesn't work for images with multiple frames. 412 // FIXME: this doesn't work for images with multiple frames.
413 if (m_frameBufferCache.isEmpty()) { 413 if (m_frameBufferCache.isEmpty()) {
414 m_frameBufferCache.resize(1); 414 m_frameBufferCache.resize(1);
415 m_frameBufferCache[0].setRequiredPreviousFrameIndex( 415 m_frameBufferCache[0].setRequiredPreviousFrameIndex(
416 findRequiredPreviousFrame(0, false)); 416 findRequiredPreviousFrame(0, false));
417 } 417 }
418 m_frameBufferCache[0].setMemoryAllocator(allocator); 418 m_frameBufferCache[0].setMemoryAllocator(allocator);
419 } 419 }
420 420
421 protected: 421 protected:
422 // Calculates the most recent frame whose image data may be needed in 422 // Calculates the most recent frame whose image data may be needed in
423 // order to decode frame |frameIndex|, based on frame disposal methods 423 // order to decode frame |frameIndex|, based on frame disposal methods
424 // and |frameRectIsOpaque|, where |frameRectIsOpaque| signifies whether 424 // and |frameRectIsOpaque|, where |frameRectIsOpaque| signifies whether
425 // the rectangle of frame at |frameIndex| is known to be opaque. 425 // the rectangle of frame at |frameIndex| is known to be opaque.
426 // If no previous frame's data is required, returns WTF::notFound. 426 // If no previous frame's data is required, returns WTF::kNotFound.
427 // 427 //
428 // This function requires that the previous frame's 428 // This function requires that the previous frame's
429 // |m_requiredPreviousFrameIndex| member has been set correctly. The 429 // |m_requiredPreviousFrameIndex| member has been set correctly. The
430 // easiest way to ensure this is for subclasses to call this method and 430 // easiest way to ensure this is for subclasses to call this method and
431 // store the result on the frame via setRequiredPreviousFrameIndex() 431 // store the result on the frame via setRequiredPreviousFrameIndex()
432 // as soon as the frame has been created and parsed sufficiently to 432 // as soon as the frame has been created and parsed sufficiently to
433 // determine the disposal method; assuming this happens for all frames 433 // determine the disposal method; assuming this happens for all frames
434 // in order, the required invariant will hold. 434 // in order, the required invariant will hold.
435 // 435 //
436 // Image formats which do not use more than one frame do not need to 436 // Image formats which do not use more than one frame do not need to
(...skipping 22 matching lines...) Expand all
459 459
460 IntSize m_size; 460 IntSize m_size;
461 bool m_sizeAvailable; 461 bool m_sizeAvailable;
462 bool m_isAllDataReceived; 462 bool m_isAllDataReceived;
463 bool m_failed; 463 bool m_failed;
464 }; 464 };
465 465
466 } // namespace WebCore 466 } // namespace WebCore
467 467
468 #endif 468 #endif
OLDNEW
« no previous file with comments | « Source/core/platform/graphics/SVGGlyph.cpp ('k') | Source/core/platform/image-decoders/ImageDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698