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

Side by Side Diff: Source/platform/graphics/ImageFrameGenerator.h

Issue 105773003: Teach Skia to use discardable memory (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: merged and discardable Created 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 static PassRefPtr<ImageFrameGenerator> create(const SkISize& fullSize, PassR efPtr<SharedBuffer> data, bool allDataReceived, bool isMultiFrame = false) 59 static PassRefPtr<ImageFrameGenerator> create(const SkISize& fullSize, PassR efPtr<SharedBuffer> data, bool allDataReceived, bool isMultiFrame = false)
60 { 60 {
61 return adoptRef(new ImageFrameGenerator(fullSize, data, allDataReceived, isMultiFrame)); 61 return adoptRef(new ImageFrameGenerator(fullSize, data, allDataReceived, isMultiFrame));
62 } 62 }
63 63
64 ImageFrameGenerator(const SkISize& fullSize, PassRefPtr<SharedBuffer>, bool allDataReceived, bool isMultiFrame); 64 ImageFrameGenerator(const SkISize& fullSize, PassRefPtr<SharedBuffer>, bool allDataReceived, bool isMultiFrame);
65 ~ImageFrameGenerator(); 65 ~ImageFrameGenerator();
66 66
67 const ScaledImageFragment* decodeAndScale(const SkISize& scaledSize, size_t index = 0); 67 const ScaledImageFragment* decodeAndScale(const SkISize& scaledSize, size_t index = 0);
68 68
69 // Decodes and scales the specified frame indicated by |index|. Dimensions
70 // and output format are specified in |info|. Decoded pixels are written
71 // into |pixels| with a stride of |rowBytes|.
72 //
73 // Returns true if decoding was successful.
74 bool decodeAndScale(const SkImageInfo&, size_t index, void* pixels, size_t r owBytes);
75
69 void setData(PassRefPtr<SharedBuffer>, bool allDataReceived); 76 void setData(PassRefPtr<SharedBuffer>, bool allDataReceived);
70 77
71 // Creates a new SharedBuffer containing the data received so far. 78 // Creates a new SharedBuffer containing the data received so far.
72 void copyData(RefPtr<SharedBuffer>*, bool* allDataReceived); 79 void copyData(RefPtr<SharedBuffer>*, bool* allDataReceived);
73 80
74 SkISize getFullSize() const { return m_fullSize; } 81 SkISize getFullSize() const { return m_fullSize; }
75 82
76 bool isMultiFrame() const { return m_isMultiFrame; } 83 bool isMultiFrame() const { return m_isMultiFrame; }
77 84
78 // FIXME: Return alpha state for each frame. 85 // FIXME: Return alpha state for each frame.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // Prevents multiple decode operations on the same data. 120 // Prevents multiple decode operations on the same data.
114 Mutex m_decodeMutex; 121 Mutex m_decodeMutex;
115 122
116 // Protect concurrent access to m_hasAlpha. 123 // Protect concurrent access to m_hasAlpha.
117 Mutex m_alphaMutex; 124 Mutex m_alphaMutex;
118 }; 125 };
119 126
120 } // namespace WebCore 127 } // namespace WebCore
121 128
122 #endif 129 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698