Ben Wagner | 63fd760 | 2017-10-09 15:45:33 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
yangsu@google.com | 0264276 | 2011-06-17 18:31:01 +0000 | [diff] [blame] | 8 | #import "FileReaderWindow.h" |
| 9 | #import "SkGradientShader.h" |
| 10 | |
| 11 | bool gNeverSetToTrueJustNeedToFoolLinker; |
| 12 | static void init_effects() { |
| 13 | if (gNeverSetToTrueJustNeedToFoolLinker) { |
| 14 | SkPoint p = SkPoint::Make(0,0); |
| 15 | SkPoint q = SkPoint::Make(100,100); |
| 16 | SkPoint pts[] = {p, q}; |
| 17 | SkColor colors[] = { SK_ColorRED, SK_ColorGREEN }; |
| 18 | SkScalar pos[] = { 0, 1.0}; |
Ben Wagner | 63fd760 | 2017-10-09 15:45:33 -0400 | [diff] [blame] | 19 | SkGradientShader::CreateLinear(pts, colors, pos, 2, |
yangsu@google.com | 0264276 | 2011-06-17 18:31:01 +0000 | [diff] [blame] | 20 | SkShader::kMirror_TileMode); |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | @implementation FileReaderWindow |
| 25 | -(void) installSkViews { |
| 26 | init_effects(); |
| 27 | fReaderView = new ReaderView; |
| 28 | fReaderView->setVisibleP(true); |
| 29 | fReaderView->setSize([self frame].size.width, [self frame].size.height); |
| 30 | [fView addSkView:fReaderView]; |
| 31 | [fView setNeedsDisplay:YES]; |
| 32 | fReaderView->unref(); |
Ben Wagner | 63fd760 | 2017-10-09 15:45:33 -0400 | [diff] [blame] | 33 | //TODO - Temporary fix. Inval doesn't Seem to be working. |
| 34 | [NSTimer scheduledTimerWithTimeInterval:0.01 target:self |
| 35 | selector:@selector(redraw) userInfo:nil |
yangsu@google.com | 0264276 | 2011-06-17 18:31:01 +0000 | [diff] [blame] | 36 | repeats:YES]; |
| 37 | } |
| 38 | |
| 39 | - (void)redraw { |
| 40 | [fView setNeedsDisplay:YES]; |
| 41 | } |
Ben Wagner | 63fd760 | 2017-10-09 15:45:33 -0400 | [diff] [blame] | 42 | @end |
| 43 | |