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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/Image.cpp

Issue 2939243002: cc/blink: Veto checker-imaging for multipart image resources. (Closed)
Patch Set: tested Created 3 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/Image.h ('k') | no next file » | 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 (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "platform/wtf/StdLibExtras.h" 44 #include "platform/wtf/StdLibExtras.h"
45 #include "public/platform/Platform.h" 45 #include "public/platform/Platform.h"
46 #include "public/platform/WebData.h" 46 #include "public/platform/WebData.h"
47 #include "third_party/skia/include/core/SkImage.h" 47 #include "third_party/skia/include/core/SkImage.h"
48 48
49 #include <math.h> 49 #include <math.h>
50 #include <tuple> 50 #include <tuple>
51 51
52 namespace blink { 52 namespace blink {
53 53
54 Image::Image(ImageObserver* observer) 54 Image::Image(ImageObserver* observer, bool is_multipart)
55 : image_observer_disabled_(false), 55 : image_observer_disabled_(false),
56 image_observer_(observer), 56 image_observer_(observer),
57 stable_image_id_(PaintImage::GetNextId()) {} 57 stable_image_id_(PaintImage::GetNextId()),
58 is_multipart_(is_multipart) {}
58 59
59 Image::~Image() {} 60 Image::~Image() {}
60 61
61 Image* Image::NullImage() { 62 Image* Image::NullImage() {
62 DCHECK(IsMainThread()); 63 DCHECK(IsMainThread());
63 DEFINE_STATIC_REF(Image, null_image, (BitmapImage::Create())); 64 DEFINE_STATIC_REF(Image, null_image, (BitmapImage::Create()));
64 return null_image; 65 return null_image;
65 } 66 }
66 67
67 PassRefPtr<Image> Image::LoadPlatformResource(const char* name) { 68 PassRefPtr<Image> Image::LoadPlatformResource(const char* name) {
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 return image.Release(); 344 return image.Release();
344 } 345 }
345 346
346 PaintImage Image::PaintImageForCurrentFrame() { 347 PaintImage Image::PaintImageForCurrentFrame() {
347 auto animation_type = MaybeAnimated() ? PaintImage::AnimationType::ANIMATED 348 auto animation_type = MaybeAnimated() ? PaintImage::AnimationType::ANIMATED
348 : PaintImage::AnimationType::STATIC; 349 : PaintImage::AnimationType::STATIC;
349 auto completion_state = CurrentFrameIsComplete() 350 auto completion_state = CurrentFrameIsComplete()
350 ? PaintImage::CompletionState::DONE 351 ? PaintImage::CompletionState::DONE
351 : PaintImage::CompletionState::PARTIALLY_DONE; 352 : PaintImage::CompletionState::PARTIALLY_DONE;
352 return PaintImage(stable_image_id_, ImageForCurrentFrame(), animation_type, 353 return PaintImage(stable_image_id_, ImageForCurrentFrame(), animation_type,
353 completion_state, FrameCount()); 354 completion_state, FrameCount(), is_multipart_);
354 } 355 }
355 356
356 bool Image::ApplyShader(PaintFlags& flags, const SkMatrix& local_matrix) { 357 bool Image::ApplyShader(PaintFlags& flags, const SkMatrix& local_matrix) {
357 // Default shader impl: attempt to build a shader based on the current frame 358 // Default shader impl: attempt to build a shader based on the current frame
358 // SkImage. 359 // SkImage.
359 sk_sp<SkImage> image = ImageForCurrentFrame(); 360 sk_sp<SkImage> image = ImageForCurrentFrame();
360 if (!image) 361 if (!image)
361 return false; 362 return false;
362 363
363 flags.setShader( 364 flags.setShader(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 FloatRect subset = dest; 401 FloatRect subset = dest;
401 subset.SetX((dest.X() - tile.X()) / scale.Width()); 402 subset.SetX((dest.X() - tile.X()) / scale.Width());
402 subset.SetY((dest.Y() - tile.Y()) / scale.Height()); 403 subset.SetY((dest.Y() - tile.Y()) / scale.Height());
403 subset.SetWidth(dest.Width() / scale.Width()); 404 subset.SetWidth(dest.Width() / scale.Width());
404 subset.SetHeight(dest.Height() / scale.Height()); 405 subset.SetHeight(dest.Height() / scale.Height());
405 406
406 return subset; 407 return subset;
407 } 408 }
408 409
409 } // namespace blink 410 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/Image.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698