OLD | NEW |
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 * | 7 * |
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } | 43 } |
44 | 44 |
45 LazyDecodingPixelRef::~LazyDecodingPixelRef() | 45 LazyDecodingPixelRef::~LazyDecodingPixelRef() |
46 { | 46 { |
47 } | 47 } |
48 | 48 |
49 SkData* LazyDecodingPixelRef::onRefEncodedData() | 49 SkData* LazyDecodingPixelRef::onRefEncodedData() |
50 { | 50 { |
51 // If the image has been clipped or scaled, do not return the original encod
ed data, since | 51 // If the image has been clipped or scaled, do not return the original encod
ed data, since |
52 // on playback it will not be known how the clipping/scaling was done. | 52 // on playback it will not be known how the clipping/scaling was done. |
53 RefPtr<SharedBuffer> buffer = 0; | 53 RefPtr<SharedBuffer> buffer = nullptr; |
54 bool allDataReceived = false; | 54 bool allDataReceived = false; |
55 m_frameGenerator->copyData(&buffer, &allDataReceived); | 55 m_frameGenerator->copyData(&buffer, &allDataReceived); |
56 if (buffer && allDataReceived) { | 56 if (buffer && allDataReceived) { |
57 SkData* skdata = SkData::NewWithCopy((void*)buffer->data(), buffer->size
()); | 57 SkData* skdata = SkData::NewWithCopy((void*)buffer->data(), buffer->size
()); |
58 return skdata; | 58 return skdata; |
59 } | 59 } |
60 return 0; | 60 return 0; |
61 } | 61 } |
62 | 62 |
63 bool LazyDecodingPixelRef::onNewLockPixels(LockRec* rec) | 63 bool LazyDecodingPixelRef::onNewLockPixels(LockRec* rec) |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 115 } |
116 | 116 |
117 void LazyDecodingPixelRef::Decode() | 117 void LazyDecodingPixelRef::Decode() |
118 { | 118 { |
119 lockPixels(); | 119 lockPixels(); |
120 unlockPixels(); | 120 unlockPixels(); |
121 } | 121 } |
122 | 122 |
123 | 123 |
124 } // namespace blink | 124 } // namespace blink |
OLD | NEW |