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

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

Issue 105773003: Teach Skia to use discardable memory (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 static PassRefPtr<ImageFrameGenerator> create(const SkISize& fullSize, PassR efPtr<SharedBuffer> data, bool allDataReceived, bool isMultiFrame = false) 55 static PassRefPtr<ImageFrameGenerator> create(const SkISize& fullSize, PassR efPtr<SharedBuffer> data, bool allDataReceived, bool isMultiFrame = false)
56 { 56 {
57 return adoptRef(new ImageFrameGenerator(fullSize, data, allDataReceived, isMultiFrame)); 57 return adoptRef(new ImageFrameGenerator(fullSize, data, allDataReceived, isMultiFrame));
58 } 58 }
59 59
60 ImageFrameGenerator(const SkISize& fullSize, PassRefPtr<SharedBuffer>, bool allDataReceived, bool isMultiFrame); 60 ImageFrameGenerator(const SkISize& fullSize, PassRefPtr<SharedBuffer>, bool allDataReceived, bool isMultiFrame);
61 ~ImageFrameGenerator(); 61 ~ImageFrameGenerator();
62 62
63 const ScaledImageFragment* decodeAndScale(const SkISize& scaledSize, size_t index = 0); 63 const ScaledImageFragment* decodeAndScale(const SkISize& scaledSize, size_t index = 0);
64 64
65 // Decodes and scales the specified frame indicated by |index|. Dimensions
66 // and output format are specified in |info|. Decoded pixels are written
67 // into |pixels| with a stride of |rowBytes|.
68 //
69 // Returns true if decoding was successful.
70 bool decodeAndScale(const SkImageInfo&, size_t index, void* pixels, size_t r owBytes);
71
65 void setData(PassRefPtr<SharedBuffer>, bool allDataReceived); 72 void setData(PassRefPtr<SharedBuffer>, bool allDataReceived);
66 73
67 // Creates a new SharedBuffer containing the data received so far. 74 // Creates a new SharedBuffer containing the data received so far.
68 void copyData(RefPtr<SharedBuffer>*, bool* allDataReceived); 75 void copyData(RefPtr<SharedBuffer>*, bool* allDataReceived);
69 76
70 SkISize getFullSize() const { return m_fullSize; } 77 SkISize getFullSize() const { return m_fullSize; }
71 78
72 bool isMultiFrame() const { return m_isMultiFrame; } 79 bool isMultiFrame() const { return m_isMultiFrame; }
73 80
74 // FIXME: Return alpha state for each frame. 81 // FIXME: Return alpha state for each frame.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // Prevents multiple decode operations on the same data. 116 // Prevents multiple decode operations on the same data.
110 Mutex m_decodeMutex; 117 Mutex m_decodeMutex;
111 118
112 // Protect concurrent access to m_hasAlpha. 119 // Protect concurrent access to m_hasAlpha.
113 Mutex m_alphaMutex; 120 Mutex m_alphaMutex;
114 }; 121 };
115 122
116 } // namespace WebCore 123 } // namespace WebCore
117 124
118 #endif 125 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698