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

Side by Side Diff: src/utils/win/SkDWriteFontFileStream.cpp

Issue 18503009: Fix SkTFits in to work properly with signed/unsigned mixtures. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Actually add all of the files. Created 7 years, 5 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
« no previous file with comments | « src/utils/SkTLogic.h ('k') | tests/FitsInTest.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 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkTypes.h" 8 #include "SkTypes.h"
9 #include "SkDWriteFontFileStream.h" 9 #include "SkDWriteFontFileStream.h"
10 #include "SkHRESULT.h" 10 #include "SkHRESULT.h"
11 #include "SkTemplates.h" 11 #include "SkTemplates.h"
12 #include "SkTFitsIn.h"
12 #include "SkTScopedComPtr.h" 13 #include "SkTScopedComPtr.h"
13 14
14 #include <dwrite.h> 15 #include <dwrite.h>
15 #include <limits> 16 #include <limits>
bungeman-skia 2013/07/10 22:06:17 After converting the other one, this can be remove
16 17
17 /////////////////////////////////////////////////////////////////////////////// 18 ///////////////////////////////////////////////////////////////////////////////
18 // SkIDWriteFontFileStream 19 // SkIDWriteFontFileStream
19 20
20 SkDWriteFontFileStream::SkDWriteFontFileStream(IDWriteFontFileStream* fontFileSt ream) 21 SkDWriteFontFileStream::SkDWriteFontFileStream(IDWriteFontFileStream* fontFileSt ream)
21 : fFontFileStream(SkRefComPtr(fontFileStream)) 22 : fFontFileStream(SkRefComPtr(fontFileStream))
22 , fPos(0) 23 , fPos(0)
23 , fLockedMemory(NULL) 24 , fLockedMemory(NULL)
24 , fFragmentLock(NULL) { 25 , fFragmentLock(NULL) {
25 } 26 }
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 { 177 {
177 // The loader is responsible for doing a bounds check. 178 // The loader is responsible for doing a bounds check.
178 UINT64 fileSize; 179 UINT64 fileSize;
179 this->GetFileSize(&fileSize); 180 this->GetFileSize(&fileSize);
180 if (fileOffset > fileSize || fragmentSize > fileSize - fileOffset) { 181 if (fileOffset > fileSize || fragmentSize > fileSize - fileOffset) {
181 *fragmentStart = NULL; 182 *fragmentStart = NULL;
182 *fragmentContext = NULL; 183 *fragmentContext = NULL;
183 return E_FAIL; 184 return E_FAIL;
184 } 185 }
185 186
186 if (fileOffset + fragmentSize > (std::numeric_limits<size_t>::max)()) { 187 if (fileOffset + fragmentSize > (std::numeric_limits<size_t>::max)()) {
bungeman-skia 2013/07/10 22:06:17 Missed this one. Done
187 return E_FAIL; 188 return E_FAIL;
188 } 189 }
189 190
190 const void* data = fStream->getMemoryBase(); 191 const void* data = fStream->getMemoryBase();
191 if (NULL != data) { 192 if (NULL != data) {
192 *fragmentStart = static_cast<BYTE const*>(data) + static_cast<size_t>(fi leOffset); 193 *fragmentStart = static_cast<BYTE const*>(data) + static_cast<size_t>(fi leOffset);
193 *fragmentContext = NULL; 194 *fragmentContext = NULL;
194 195
195 } else { 196 } else {
196 //May be called from multiple threads. 197 //May be called from multiple threads.
(...skipping 26 matching lines...) Expand all
223 HRESULT STDMETHODCALLTYPE SkDWriteFontFileStreamWrapper::GetFileSize(UINT64* fil eSize) { 224 HRESULT STDMETHODCALLTYPE SkDWriteFontFileStreamWrapper::GetFileSize(UINT64* fil eSize) {
224 *fileSize = fStream->getLength(); 225 *fileSize = fStream->getLength();
225 return S_OK; 226 return S_OK;
226 } 227 }
227 228
228 HRESULT STDMETHODCALLTYPE SkDWriteFontFileStreamWrapper::GetLastWriteTime(UINT64 * lastWriteTime) { 229 HRESULT STDMETHODCALLTYPE SkDWriteFontFileStreamWrapper::GetLastWriteTime(UINT64 * lastWriteTime) {
229 // The concept of last write time does not apply to this loader. 230 // The concept of last write time does not apply to this loader.
230 *lastWriteTime = 0; 231 *lastWriteTime = 0;
231 return E_NOTIMPL; 232 return E_NOTIMPL;
232 } 233 }
OLDNEW
« no previous file with comments | « src/utils/SkTLogic.h ('k') | tests/FitsInTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698